From 578d6f7cedef14e677c7e0793de3e9d1dcc32941 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Tue, 15 Feb 2011 11:40:43 +0100 Subject: now ctest does compile the test even though they are not in the "all" target --- CMakeLists.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e70fd7cae..5d7bace5a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -277,11 +277,27 @@ add_subdirectory(Eigen) add_subdirectory(doc EXCLUDE_FROM_ALL) +# CMake/Ctest does not allow us to change the build command, +# so we have to workaround by directely editing the generated DartConfiguration.tcl file +# save CMAKE_MAKE_PROGRAM +set(CMAKE_MAKE_PROGRAM_SAVE ${CMAKE_MAKE_PROGRAM}) +# and set a fake one +set(CMAKE_MAKE_PROGRAM "@EIGEN_MAKECOMMAND_PLACEHOLDER@") + include(CTest) enable_testing() # must be called from the root CMakeLists, see man page include(EigenTesting) ei_init_testing() +# overwrite default DartConfiguration.tcl +set(EIGEN_MAKECOMMAND_PLACEHOLDER "${CMAKE_MAKE_PROGRAM_SAVE} buildtests") +configure_file(${CMAKE_BINARY_DIR}/DartConfiguration.tcl ${CMAKE_BINARY_DIR}/DartConfiguration.tcl) +# restore default CMAKE_MAKE_PROGRAM +set(CMAKE_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM_SAVE}) +unset(CMAKE_MAKE_PROGRAM_SAVE) +unset(EIGEN_MAKECOMMAND_PLACEHOLDER) + + if(EIGEN_LEAVE_TEST_IN_ALL_TARGET) add_subdirectory(test) # can't do EXCLUDE_FROM_ALL here, breaks CTest else() -- cgit v1.2.3