Skip to content

Commit

Permalink
Added a workaround for CMake versions prior 3.x.x.
Browse files Browse the repository at this point in the history
Added a workaround for yesterday's commit regarding the unit tests and CMake
generator expressions. CMake versions prior 3.x.x do not understand $<CONFIG>
and require using $<CONFIGURATION>, which is in turn deprecated since 3.x.x.
Good thing this issue was totally not annoying.
  • Loading branch information
Jan Schlamelcher committed Jan 18, 2018
1 parent 8ac2251 commit 4ba1368
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMake/dcmtkMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ FUNCTION(DCMTK_ADD_TESTS MODULE)
SET_PROPERTY(TEST "${TEST}" PROPERTY REQUIRED_FILES "${TEST_EXECUTABLE}")
ENDFOREACH(TEST_LINE)
ADD_CUSTOM_TARGET("${MODULE}-test-exhaustive"
COMMAND "${CMAKE_COMMAND}" "-DCONFIG=$<CONFIG>" "-P" "${DCMTK_SOURCE_DIR}/CMake/CTest/dcmtkCTestRunExhaustive.cmake"
COMMAND "${CMAKE_COMMAND}" "-DCONFIG=${DCMTK_CONFIG_GENERATOR_EXPRESSION}" "-P" "${DCMTK_SOURCE_DIR}/CMake/CTest/dcmtkCTestRunExhaustive.cmake"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)
ENDIF(BUILD_APPS AND DCMTK_RUN_CTEST_SCRIPT)
Expand Down
10 changes: 10 additions & 0 deletions CMake/dcmtkPrepare.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -499,3 +499,13 @@ DCMTK_TEST_SOCKET_LIBRARY(socket "socket")
IF(CMAKE_CXX_COMPILER_ID STREQUAL SunPro)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -features=tmplrefstatic")
ENDIF()

#-----------------------------------------------------------------------------
# workaround for using the deprecated generator expression $<CONFIGURATION>
# with old CMake versions that do not understand $<CONFIG>
#-----------------------------------------------------------------------------
IF(CMAKE_VERSION VERSION_LESS 3.0.0)
SET(DCMTK_CONFIG_GENERATOR_EXPRESSION "$<CONFIGURATION>" CACHE INTERNAL "the generator expression to use for retriving the current config")
ELSE()
SET(DCMTK_CONFIG_GENERATOR_EXPRESSION "$<CONFIG>" CACHE INTERNAL "the generator expression to use for retriving the current config")
ENDIF()
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ ELSE(CMAKE_CROSSCOMPILING)
ENDIF(CMAKE_CROSSCOMPILING)
# Add a target to run the unit tests in exhaustive mode
ADD_CUSTOM_TARGET("test-exhaustive"
COMMAND "${CMAKE_COMMAND}" "-DCONFIG=$<CONFIG>" "-P"
COMMAND "${CMAKE_COMMAND}" "-DCONFIG=${DCMTK_CONFIG_GENERATOR_EXPRESSION}" "-P"
"${DCMTK_SOURCE_DIR}/CMake/CTest/dcmtkCTestRunExhaustive.cmake"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
)
Expand Down

0 comments on commit 4ba1368

Please sign in to comment.