mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-04 11:10:40 +08:00
Backport DartConfiguration.tcl tricks to make ctest -D Experimental works on recent cmake versions
This commit is contained in:
parent
4c1a2b5614
commit
1a9dda6bfd
@ -26,29 +26,18 @@ include(CTest)
|
|||||||
|
|
||||||
set(EIGEN_TEST_BUILD_FLAGS " " CACHE STRING "Options passed to the build command of unit tests")
|
set(EIGEN_TEST_BUILD_FLAGS " " CACHE STRING "Options passed to the build command of unit tests")
|
||||||
|
|
||||||
# overwrite default DartConfiguration.tcl
|
# Overwrite default DartConfiguration.tcl such that ctest can build our unit tests.
|
||||||
# The worarounds are different for each version of the MSVC IDE
|
# Recall that our unit tests are not in the "all" target, so we have to explicitely ask ctest to build our custom 'buildtests' target.
|
||||||
if(MSVC_IDE)
|
# At this stage, we can also add custom flags to the build tool through the user defined EIGEN_TEST_BUILD_FLAGS variable.
|
||||||
if(CMAKE_MAKE_PROGRAM_SAVE MATCHES "devenv") # devenv
|
file(READ "${CMAKE_CURRENT_BINARY_DIR}/DartConfiguration.tcl" EIGEN_DART_CONFIG_FILE)
|
||||||
set(EIGEN_MAKECOMMAND_PLACEHOLDER "${CMAKE_MAKE_PROGRAM_SAVE} Eigen.sln /build \"Release\" /project buildtests ${EIGEN_TEST_BUILD_FLAGS} \n# ")
|
# try to grab the default flags
|
||||||
else() # msbuild
|
string(REGEX MATCH "MakeCommand:.*-- (.*)\nDefaultCTestConfigurationType" EIGEN_DUMMY ${EIGEN_DART_CONFIG_FILE})
|
||||||
set(EIGEN_MAKECOMMAND_PLACEHOLDER "${CMAKE_MAKE_PROGRAM_SAVE} buildtests.vcxproj /p:Configuration=\${CTEST_CONFIGURATION_TYPE} ${EIGEN_TEST_BUILD_FLAGS}\n# ")
|
if(NOT CMAKE_MATCH_1)
|
||||||
endif()
|
string(REGEX MATCH "MakeCommand:.*[^c]make (.*)\nDefaultCTestConfigurationType" EIGEN_DUMMY ${EIGEN_DART_CONFIG_FILE})
|
||||||
else()
|
|
||||||
# for make and nmake
|
|
||||||
set(EIGEN_MAKECOMMAND_PLACEHOLDER "${CMAKE_MAKE_PROGRAM_SAVE} buildtests ${EIGEN_TEST_BUILD_FLAGS}")
|
|
||||||
endif()
|
endif()
|
||||||
|
string(REGEX REPLACE "MakeCommand:.*DefaultCTestConfigurationType" "MakeCommand: ${CMAKE_COMMAND} --build . --target buildtests --config \"\${CTEST_CONFIGURATION_TYPE}\" -- ${CMAKE_MATCH_1} ${EIGEN_TEST_BUILD_FLAGS}\nDefaultCTestConfigurationType"
|
||||||
# copy ctest properties, which currently
|
EIGEN_DART_CONFIG_FILE2 ${EIGEN_DART_CONFIG_FILE})
|
||||||
# o raise the warning levels
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/DartConfiguration.tcl" ${EIGEN_DART_CONFIG_FILE2})
|
||||||
configure_file(${CMAKE_CURRENT_BINARY_DIR}/DartConfiguration.tcl ${CMAKE_BINARY_DIR}/DartConfiguration.tcl)
|
|
||||||
|
|
||||||
# restore default CMAKE_MAKE_PROGRAM
|
|
||||||
set(CMAKE_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM_SAVE})
|
|
||||||
# un-set temporary variables so that it is like they never existed.
|
|
||||||
# CMake 2.6.3 introduces the more logical unset() syntax for this.
|
|
||||||
set(CMAKE_MAKE_PROGRAM_SAVE)
|
|
||||||
set(EIGEN_MAKECOMMAND_PLACEHOLDER)
|
|
||||||
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.cmake.in ${CMAKE_BINARY_DIR}/CTestCustom.cmake)
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.cmake.in ${CMAKE_BINARY_DIR}/CTestCustom.cmake)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user