Update CMakeLists.txt to match current CMAKE versions (#641)
authorAlpar Juttner <alpar@cs.elte.hu>
Thu, 21 Jan 2021 08:36:53 +0100
changeset 1426736a341e604b
parent 1423 8c567e298d7f
child 1429 eba5aa390aca
Update CMakeLists.txt to match current CMAKE versions (#641)
CMakeLists.txt
test/CMakeLists.txt
     1.1 --- a/CMakeLists.txt	Sat Oct 27 13:00:48 2018 +0200
     1.2 +++ b/CMakeLists.txt	Thu Jan 21 08:36:53 2021 +0100
     1.3 @@ -5,12 +5,12 @@
     1.4  ENDIF(POLICY CMP0048)
     1.5  
     1.6  IF(POLICY CMP0043) 
     1.7 -  CMAKE_POLICY(SET CMP0043 OLD) 
     1.8 +  CMAKE_POLICY(SET CMP0043 NEW)
     1.9  ENDIF(POLICY CMP0043)
    1.10  
    1.11  IF(POLICY CMP0026)
    1.12    #This is for copying the dll's needed by glpk (in lp_test and mip_test)
    1.13 -  CMAKE_POLICY(SET CMP0026 OLD) 
    1.14 +  CMAKE_POLICY(SET CMP0026 NEW)
    1.15  ENDIF(POLICY CMP0026)
    1.16  
    1.17  SET(PROJECT_NAME "LEMON")
    1.18 @@ -196,36 +196,36 @@
    1.19  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LEMON_CXX_WARNING_FLAGS}")
    1.20  
    1.21  IF(MSVC)
    1.22 -  SET(CMAKE_CXX_FLAGS "/bigobj ${CMAKE_CXX_FLAGS}")
    1.23 +  SET( CMAKE_CXX_FLAGS "/bigobj ${CMAKE_CXX_FLAGS}")
    1.24    SET( CMAKE_CXX_FLAGS_MAINTAINER "/WX ${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING
    1.25 -    "Flags used by the C++ compiler during maintainer builds."
    1.26 +    "Flags used by the C++ compiler during maintainer builds." FORCE
    1.27      )
    1.28    SET( CMAKE_C_FLAGS_MAINTAINER "/WX ${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING
    1.29 -    "Flags used by the C compiler during maintainer builds."
    1.30 +    "Flags used by the C compiler during maintainer builds." FORCE
    1.31      )
    1.32    SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER
    1.33      "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING
    1.34 -    "Flags used for linking binaries during maintainer builds."
    1.35 +    "Flags used for linking binaries during maintainer builds." FORCE
    1.36      )
    1.37    SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
    1.38      "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING
    1.39      "Flags used by the shared libraries linker during maintainer builds."
    1.40 +     FORCE
    1.41      )
    1.42  ELSE()
    1.43    SET( CMAKE_CXX_FLAGS_MAINTAINER "-Werror -ggdb -O0" CACHE STRING
    1.44 -    "Flags used by the C++ compiler during maintainer builds."
    1.45 +    "Flags used by the C++ compiler during maintainer builds." FORCE
    1.46      )
    1.47    SET( CMAKE_C_FLAGS_MAINTAINER "-Werror -O0" CACHE STRING
    1.48 -    "Flags used by the C compiler during maintainer builds."
    1.49 +    "Flags used by the C compiler during maintainer builds." FORCE
    1.50      )
    1.51    SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER
    1.52      "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING
    1.53 -    "Flags used for linking binaries during maintainer builds."
    1.54 +    "Flags used for linking binaries during maintainer builds." FORCE
    1.55      )
    1.56    SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
    1.57      "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING
    1.58 -    "Flags used by the shared libraries linker during maintainer builds."
    1.59 -    )
    1.60 +    "Flags used by the shared libraries linker during maintainer builds." FORCE)
    1.61  ENDIF()
    1.62  
    1.63  MARK_AS_ADVANCED(
    1.64 @@ -251,8 +251,8 @@
    1.65      FORCE )
    1.66  
    1.67  SET_DIRECTORY_PROPERTIES(PROPERTIES
    1.68 -  COMPILE_DEFINITIONS_DEBUG "LEMON_ENABLE_DEBUG"
    1.69 -  COMPILE_DEFINITIONS_MAINTAINER "LEMON_ENABLE_DEBUG"
    1.70 +  COMPILE_DEFINITIONS
    1.71 +  $<$<OR:$<CONFIG:Debug>,$<CONFIG:Maintainer>>:LEMON_ENABLE_DEBUG>
    1.72  )
    1.73  
    1.74  INCLUDE(CheckTypeSize)
     2.1 --- a/test/CMakeLists.txt	Sat Oct 27 13:00:48 2018 +0200
     2.2 +++ b/test/CMakeLists.txt	Thu Jan 21 08:36:53 2021 +0100
     2.3 @@ -84,12 +84,10 @@
     2.4    ADD_DEPENDENCIES(check lp_test)
     2.5  
     2.6    IF(WIN32 AND LEMON_HAVE_GLPK)
     2.7 -    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
     2.8 -    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
     2.9      ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    2.10 -      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
    2.11 -      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
    2.12 -      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
    2.13 +      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll $<TARGET_FILE_DIR:lp_test>
    2.14 +      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll $<TARGET_FILE_DIR:lp_test>
    2.15 +      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll $<TARGET_FILE_DIR:lp_test>
    2.16      )
    2.17    ENDIF()
    2.18