[Cmake-commits] [cmake-commits] hoffman committed CMakeBuildTest.cmake.in NONE 1.1 CMakeLists.txt 1.65 1.66
cmake-commits at cmake.org
cmake-commits at cmake.org
Wed Oct 15 13:56:09 EDT 2008
Update of /cvsroot/CMake/CMake/Tests
In directory public:/mounts/ram/cvs-serv20763/Tests
Modified Files:
CMakeLists.txt
Added Files:
CMakeBuildTest.cmake.in
Log Message:
BUG: 4244, add a --build option to cmake that can build projects configured by CMake
--- NEW FILE: CMakeBuildTest.cmake.in ---
# create the binary directory
make_directory("@CMAKE_BUILD_TEST_BINARY_DIR@")
# run cmake in the binary directory
execute_process(COMMAND "@CMAKE_CMAKE_COMMAND@"
"@CMAKE_BUILD_TEST_SOURCE_DIR@"
"-G at CMAKE_TEST_GENERATOR@"
WORKING_DIRECTORY "@CMAKE_BUILD_TEST_BINARY_DIR@"
RESULT_VARIABLE RESULT)
if(RESULT)
message(FATAL_ERROR "Error running cmake command")
endif(RESULT)
# Now use the --build option to build the project
execute_process(COMMAND "@CMAKE_CMAKE_COMMAND@"
--build "@CMAKE_BUILD_TEST_BINARY_DIR@" --config Debug
RESULT_VARIABLE RESULT)
if(RESULT)
message(FATAL_ERROR "Error running cmake --build")
endif(RESULT)
# check for configuration types
set(CMAKE_CONFIGURATION_TYPES @CMAKE_CONFIGURATION_TYPES@)
# run the executable out of the Debug directory if there
# are configuration types
if(CMAKE_CONFIGURATION_TYPES)
set(RUN_TEST "@CMAKE_BUILD_TEST_BINARY_DIR@/Debug/COnly")
else(CMAKE_CONFIGURATION_TYPES)
set(RUN_TEST "@CMAKE_BUILD_TEST_BINARY_DIR@/COnly")
endif(CMAKE_CONFIGURATION_TYPES)
# run the test results
message("running [${RUN_TEST}]")
execute_process(COMMAND "${RUN_TEST}" RESULT_VARIABLE RESULT)
if(RESULT)
message(FATAL_ERROR "Error running test COnly")
endif(RESULT)
# build it again with clean and only COnly target
execute_process(COMMAND "@CMAKE_CMAKE_COMMAND@"
--build "@CMAKE_BUILD_TEST_BINARY_DIR@" --config Debug
--clean --target COnly
RESULT_VARIABLE RESULT)
if(RESULT)
message(FATAL_ERROR "Error running cmake --build")
endif(RESULT)
# run it again after clean
execute_process(COMMAND "${RUN_TEST}" RESULT_VARIABLE RESULT)
if(RESULT)
message(FATAL_ERROR "Error running test COnly after clean ")
endif(RESULT)
Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/CMakeLists.txt,v
retrieving revision 1.65
retrieving revision 1.66
diff -C 2 -d -r1.65 -r1.66
*** CMakeLists.txt 25 Aug 2008 14:31:29 -0000 1.65
--- CMakeLists.txt 15 Oct 2008 17:56:07 -0000 1.66
***************
*** 97,100 ****
--- 97,106 ----
ADD_TEST_MACRO(Unset Unset)
+ SET(CMAKE_BUILD_TEST_SOURCE_DIR "${CMake_SOURCE_DIR}/Tests/COnly")
+ SET(CMAKE_BUILD_TEST_BINARY_DIR "${CMake_BINARY_DIR}/Tests/CMakeBuildCOnly")
+ CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CMakeBuildTest.cmake.in"
+ "${CMake_BINARY_DIR}/Tests/CMakeBuildTest.cmake" @ONLY)
+ ADD_TEST(CMakeBuildTest ${CMAKE_CMAKE_COMMAND} -P
+ "${CMake_BINARY_DIR}/Tests/CMakeBuildTest.cmake")
# If we are running right now with a UnixMakefiles based generator,
More information about the Cmake-commits
mailing list