3

私はCMakeが初めてです。Visual Studio 2010 Express を使用して非常に単純なプログラム (hello world) を構築しようとしています。Visual Studio 2010 コマンド プロンプトで、次のコマンドを実行しました。

cmake -g "NMake Makefiles" .

これは機能しているように見えました。

C:\Users\david\dev\cmake\hello_world>cmake -g "NMake Makefiles" .
-- Building for: Visual Studio 10
-- Check for working C compiler using: Visual Studio 10
-- Check for working C compiler using: Visual Studio 10 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 10
-- Check for working CXX compiler using: Visual Studio 10 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/david/dev/cmake/hello_world

次に、nmake を実行しようとしましたが、次のエラーが発生しました。

C:\Users\david\dev\cmake\hello_world>nmake

Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation.  All rights reserved.

NMAKE : fatal error U1064: MAKEFILE not found and no target specified
Stop.

プロジェクト ディレクトリ内に Makefile が表示されないので、それが機能していないのだと思います。それとも、CMake が Makefile に非標準の名前を使用しているのかもしれません。よくわかりません。プロジェクトディレクトリの内容を以下に貼り付けました。

C:\Users\david\dev\cmake\hello_world>dir
 Volume in drive C has no label.
 Volume Serial Number is 4000-10E9

 Directory of C:\Users\david\dev\cmake\hello_world

08/05/2012  01:38 PM    <DIR>          .
08/05/2012  01:38 PM    <DIR>          ..
08/05/2012  01:38 PM            28,584 ALL_BUILD.vcxproj
08/05/2012  01:38 PM               735 ALL_BUILD.vcxproj.filters
08/05/2012  01:38 PM            12,871 CMakeCache.txt
08/05/2012  01:38 PM    <DIR>          CMakeFiles
08/05/2012  01:34 PM               151 CMakeLists.txt
08/05/2012  01:38 PM             1,514 cmake_install.cmake
08/05/2012  01:38 PM             3,150 hello_world.sln
08/05/2012  01:38 PM            36,618 hello_world.vcxproj
08/05/2012  01:38 PM               671 hello_world.vcxproj.filters
08/05/2012  01:37 PM             2,213 hello_world.vpj
08/05/2012  01:37 PM               206 hello_world.vpw
08/05/2012  01:37 PM               134 hello_world.vpwhist
08/05/2012  01:37 PM           106,496 hello_world.vtg
08/05/2012  07:14 AM               118 main.cpp
08/05/2012  01:38 PM            23,914 ZERO_CHECK.vcxproj
08/05/2012  01:38 PM               807 ZERO_CHECK.vcxproj.filters
              15 File(s)        218,182 bytes
               3 Dir(s)  134,161,678,336 bytes free

私のプログラムのソースは次のとおりです。

#include <iostream>

int main(int argc, char* argv[])
{
    std::cout << *argv << std::endl;

    return 0;
}

私の CMakeLists.txt は次のとおりです。

# CMakeLists.txt
# $ cmake -g "NMake Makefiles" .

cmake_minimum_required(VERSION 2.8)
project(hello_world)
add_executable(hello_world main.cpp)

ありがとう、

4

0 に答える 0