bradbell@gorst trash]$ cmake --version
cmake version 2.6-patch 4While doing so I am having trouble with the ADD_CUSTOM_TARGET. To be specifc, after building a custom target, cmake seems to forget it has done so.
Below is an example CMakeLists for which
make check
works with cmake 2.8.9 and fails with 2.6-patch 4:
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
#
PROJECT(hello)
#
ADD_EXECUTABLE(hello_one EXCLUDE_FROM_ALL hello_one.cpp )
ADD_EXECUTABLE(hello_two EXCLUDE_FROM_ALL hello_two.cpp )
#
ADD_CUSTOM_TARGET(check_one hello_one DEPENDS hello_one)
ADD_CUSTOM_TARGET(check_two hello_two DEPENDS hello_two)
#
ADD_CUSTOM_TARGET(check DEPENDS check_one check_two)
I am attaching a bash script that creates the necessary files and runs
the make check command. The output I get on Red-Hat 6 is
[bradbell@gorst trash]$ ./cmake_target.sh -- The C compiler identification is GNU -- The CXX compiler identification is GNU -- Check for working C compiler: /usr/bin/gcc -- Check for working C compiler: /usr/bin/gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Configuring done -- Generating done -- Build files have been written to: /homes/bradbell/trash/build Scanning dependencies of target hello_two [ 50%] Building CXX object CMakeFiles/hello_two.dir/hello_two.cpp.o Linking CXX executable hello_two [ 50%] Built target hello_two Scanning dependencies of target check_two hello_two [ 50%] Built target check_two Scanning dependencies of target hello_one [100%] Building CXX object CMakeFiles/hello_one.dir/hello_one.cpp.o Linking CXX executable hello_one [100%] Built target hello_one Scanning dependencies of target check_one hello_one [100%] Built target check_one Scanning dependencies of target checkmake[3]: *** No rule to make target `check_one', needed by `CMakeFiles/check'. Stop.
make[2]: *** [CMakeFiles/check.dir/all] Error 2 make[1]: *** [CMakeFiles/check.dir/rule] Error 2 make: *** [check] Error 2 [bradbell@gorst trash]$
cmake_target.sh
Description: application/shellscript
-- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
