CMakeはCross platform Makeの略。各OSにあわせてslnファイルやmakefileを作れる。
参照:http://fseek.exblog.jp/5637217
cmake_minimum_required(VERSION 2.8)
PROJECT(hoge)
include_directories("./include")
file(GLOB foo_sources "foo/*.cpp")
message(STATUS ${foo_sources})
cuda_add_library(bar_cuda ${cuda_sources})
find_package(CUDA QUIET REQUIRED)
add_library(hoge ${hoge_sources})
add_executable
target_link_libraries(foo hogeLibrary)
C:\work\cmake-2.6.2>cd Example C:\work\cmake-2.6.2\Example>dir 2008/09/24 14:46 500 CMakeLists.txt 2008/11/14 15:37 <DIR> Demo 2008/11/14 15:37 <DIR> Hello
C:\work\cmake-2.6.2\Example>type CMakeLists.txt # The name of our project is "HELLO". CMakeLists files in this project can # refer to the root source directory of the project as ${HELLO_SOURCE_DIR} and # to the root binary directory of the project as ${HELLO_BINARY_DIR}. project (HELLO) # Recurse into the "Hello" and "Demo" subdirectories. This does not actually # cause another cmake executable to run. The same process will walk through # the project's entire directory structure. add_subdirectory (Hello) add_subdirectory (Demo)
C:\work\cmake-2.6.2\Example>..\..\cmake\bin\cmake.exe . -- Check for working C compiler: cl -- Check for working C compiler: cl -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: cl -- Check for working CXX compiler: cl -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done CMake Warning (dev) in CMakeLists.txt: No cmake_minimum_required command is present. A line of code such as cmake_minimum_required(VERSION 2.6) should be added at the top of the file. The version specified may be lower if you wish to support older CMake versions for this project. For more information run "cmake --help-policy CMP0000". This warning is for project developers. Use -Wno-dev to suppress it. -- Configuring done -- Generating done -- Build files have been written to: C:/work/cmake-2.6.2/Example
C:\work\cmake-2.6.2\Example>dir 2008/11/14 15:39 19,889 ALL_BUILD.vcproj 2008/11/14 15:39 12,427 CMakeCache.txt 2008/11/14 15:39 <DIR> CMakeFiles 2008/09/24 14:46 500 CMakeLists.txt 2008/11/14 15:39 1,740 cmake_install.cmake 2008/11/14 15:41 <DIR> Demo 2008/11/14 15:40 <DIR> Hello 2008/11/14 15:41 191,488 HELLO.ncb 2008/11/14 15:39 4,289 HELLO.sln 2008/11/14 15:39 18,292 ZERO_CHECK.vcproj