From a4b588c43d165e69fcc7ba289054b2206131f03e Mon Sep 17 00:00:00 2001 From: Christian Schulte zu Berge Date: Wed, 20 Jan 2016 15:33:10 +0100 Subject: [PATCH] Fixed a set of obscure CMake policy warnings when using a newer version of CMake. --- CMakeLists.txt | 3 ++- application/CMakeLists.txt | 8 ++------ cmake/CAMPVisConfig.cmake.in | 5 +++-- core/CMakeLists.txt | 1 - ext/cgt/CMakeLists.txt | 5 +---- ext/sigslot/CMakeLists.txt | 2 -- modules/CMakeLists.txt | 3 --- scripting/CMakeLists.txt | 2 -- test/CMakeLists.txt | 1 - 9 files changed, 8 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d33c708..566a102c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ # = CAMPVis - Yet another medical visualization framework ===================== PROJECT(CAMPVis) -CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0 FATAL_ERROR) +CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2 FATAL_ERROR) +cmake_policy(SET CMP0020 NEW) SET(CAMPVIS_VERSION 1.0.0) diff --git a/application/CMakeLists.txt b/application/CMakeLists.txt index 570dfde6..e583354f 100644 --- a/application/CMakeLists.txt +++ b/application/CMakeLists.txt @@ -1,5 +1,4 @@ PROJECT(campvis-application) -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR) INCLUDE(../cmake/commonconf.cmake) MESSAGE(STATUS "Configuring CAMPVis-Application") @@ -123,8 +122,7 @@ ADD_LIBRARY(campvis-application-lib ) ADD_DEFINITIONS(${CampvisGlobalDefinitions} ${CampvisModulesDefinitions} ${CampvisApplicationDefinitions}) INCLUDE_DIRECTORIES(${CampvisGlobalIncludeDirs} ${CampvisModulesIncludeDirs}) -TARGET_LINK_LIBRARIES(campvis-application-lib ${CampvisMainLibs} ${CampvisGlobalExternalLibs} ${CampvisModulesExternalLibs}) -qt5_use_modules(campvis-application-lib Widgets OpenGL) +TARGET_LINK_LIBRARIES(campvis-application-lib ${CampvisMainLibs} ${CampvisGlobalExternalLibs} ${CampvisModulesExternalLibs} Qt5::Widgets Qt5::OpenGL) # if campvis-core is built as a shared library, CMake will define the following flag to instruct # the code to export DLL symbols @@ -140,9 +138,7 @@ INSTALL(TARGETS campvis-application-lib DESTINATION exports EXPORT campvis-targe ADD_EXECUTABLE(campvis-application "campvis.cpp") -TARGET_LINK_LIBRARIES(campvis-application campvis-application-lib ${CampvisMainLibs} ${CampvisGlobalExternalLibs} ${CampvisModulesExternalLibs}) -qt5_use_modules(campvis-application Widgets OpenGL) - +TARGET_LINK_LIBRARIES(campvis-application campvis-application-lib ${CampvisMainLibs} ${CampvisGlobalExternalLibs} ${CampvisModulesExternalLibs} Qt5::Widgets Qt5::OpenGL) IF(CAMPVIS_DEPLOY_SHADERS) LIST(APPEND CampvisShaderDirectories "application/data") diff --git a/cmake/CAMPVisConfig.cmake.in b/cmake/CAMPVisConfig.cmake.in index f770a0e3..363adbc1 100644 --- a/cmake/CAMPVisConfig.cmake.in +++ b/cmake/CAMPVisConfig.cmake.in @@ -11,8 +11,9 @@ set(CAMPVIS_INCLUDE_DIRS "@CampvisGlobalIncludeDirs@;@CampvisModulesIncludeDirs@ SET(CAMPVIS_DEFINITIONS @CampvisGlobalDefinitions@) -FIND_PACKAGE(Qt4 ${CampvisRequiredQtVersion} REQUIRED QtCore QtGui QtOpenGL) -INCLUDE(${QT_USE_FILE}) +FIND_PACKAGE(Qt5Widgets REQUIRED) +FIND_PACKAGE(Qt5OpenGL REQUIRED) +RESOLVE_QT5_DLL_LOCATIONS("Core;Gui;OpenGL;Widgets") SET(CGT_WITH_QT true) # Our library dependencies (contains definitions for IMPORTED targets) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 61436ee6..5b9503d3 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -1,5 +1,4 @@ PROJECT(campvis-core) -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR) INCLUDE(../cmake/commonconf.cmake) MESSAGE(STATUS "Configuring CAMPVis-Core") diff --git a/ext/cgt/CMakeLists.txt b/ext/cgt/CMakeLists.txt index a6a21e1f..adffb24d 100644 --- a/ext/cgt/CMakeLists.txt +++ b/ext/cgt/CMakeLists.txt @@ -2,7 +2,6 @@ # Project file for the cgt library ################################################################################ PROJECT(cgt) -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR) INCLUDE(../../cmake/commonconf.cmake) MESSAGE(STATUS "Configuring cgt Library") @@ -79,9 +78,7 @@ ENDIF(CGT_WITH_QT) ADD_LIBRARY(cgt ${CGT_SOURCES} ${CGT_HEADERS}) ADD_DEFINITIONS(${CampvisGlobalDefinitions} ${CampvisModulesDefinitions}) INCLUDE_DIRECTORIES(${CampvisGlobalIncludeDirs} ${CampvisModulesIncludeDirs}) -TARGET_LINK_LIBRARIES(cgt ${CampvisGlobalExternalLibs}) - -qt5_use_modules(cgt Widgets OpenGL) +TARGET_LINK_LIBRARIES(cgt ${CampvisGlobalExternalLibs} Qt5::Widgets Qt5::OpenGL) # if CGT is built as a shared library, CMake will define the following flag to instruct the code to # export DLL symbols diff --git a/ext/sigslot/CMakeLists.txt b/ext/sigslot/CMakeLists.txt index 35fd087f..e35c90ab 100644 --- a/ext/sigslot/CMakeLists.txt +++ b/ext/sigslot/CMakeLists.txt @@ -2,8 +2,6 @@ # Project file for the sigslot library ################################################################################ PROJECT(sigslot) -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR) - MESSAGE(STATUS "Configuring sigslot Library") # headers diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 70bdd843..943f9516 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -1,7 +1,4 @@ PROJECT(campvis-modules) -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR) -#INCLUDE(../cmake/commonconf.cmake) - MESSAGE(STATUS "Configuring CAMPVis-Modules") LIST(APPEND CampvisModulesHeaders diff --git a/scripting/CMakeLists.txt b/scripting/CMakeLists.txt index f014ac34..7d6c0d88 100644 --- a/scripting/CMakeLists.txt +++ b/scripting/CMakeLists.txt @@ -1,6 +1,4 @@ PROJECT(campvis-scripting) -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR) - MESSAGE(STATUS "Configuring CAMPVis-Scripting") # SWIG diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2ab78a96..eb50fd47 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1,4 @@ PROJECT(campvis-test) -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR) MESSAGE(STATUS "Configuring CAMPVis Test") FILE(GLOB TestCampvisHeaders RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} -- GitLab