mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
CMake: do not expand variables in if-expressions
CMake will do the expansion internally itself. Not doing it here is not only less code, it also makes sure one does not accidentially get a double expansion. Signed-off-by: Rolf Eike Beer <eike@sf-mail.de>
This commit is contained in:
parent
69508d7123
commit
47e9a771ba
2 changed files with 27 additions and 29 deletions
|
@ -52,7 +52,7 @@ SET_PROPERTY(CACHE SUBSURFACE_TARGET_EXECUTABLE PROPERTY STRINGS ${SUBSURFACE_AC
|
||||||
|
|
||||||
#verify if Platform is correct and warn on wxit with example.
|
#verify if Platform is correct and warn on wxit with example.
|
||||||
list (FIND SUBSURFACE_ACCEPTED_EXECUTABLES ${SUBSURFACE_TARGET_EXECUTABLE} _index)
|
list (FIND SUBSURFACE_ACCEPTED_EXECUTABLES ${SUBSURFACE_TARGET_EXECUTABLE} _index)
|
||||||
if (${_index} EQUAL -1)
|
if (_index EQUAL -1)
|
||||||
message(FATAL_ERROR "Requested platform not supported, please use one of the following:
|
message(FATAL_ERROR "Requested platform not supported, please use one of the following:
|
||||||
${SUBSURFACE_ACCEPTED_EXECUTABLES}
|
${SUBSURFACE_ACCEPTED_EXECUTABLES}
|
||||||
|
|
||||||
|
@ -68,21 +68,21 @@ add_definitions(-DSUBSURFACE_SOURCE="${SUBSURFACE_SOURCE}")
|
||||||
#
|
#
|
||||||
# TODO: This Compilation part should go on the Target specific CMake.
|
# TODO: This Compilation part should go on the Target specific CMake.
|
||||||
#
|
#
|
||||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 ")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 ")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override")
|
||||||
if((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND
|
if ((CMAKE_SYSTEM_NAME MATCHES "Darwin") AND
|
||||||
((${CMAKE_SYSTEM_VERSION} MATCHES "11.4.") OR
|
((CMAKE_SYSTEM_VERSION MATCHES "11.4.") OR
|
||||||
(${CMAKE_OSX_DEPLOYMENT_TARGET} MATCHES "10.7") OR
|
(CMAKE_OSX_DEPLOYMENT_TARGET MATCHES "10.7") OR
|
||||||
(${CMAKE_OSX_DEPLOYMENT_TARGET} MATCHES "10.8")))
|
(CMAKE_OSX_DEPLOYMENT_TARGET MATCHES "10.8")))
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
|
||||||
else()
|
else()
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||||
endif()
|
endif()
|
||||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 ")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 ")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-inconsistent-missing-override")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-inconsistent-missing-override")
|
||||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||||
|
|
||||||
|
@ -94,9 +94,9 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wfloat-conversion")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wfloat-conversion")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||||
# using Intel C++
|
# using Intel C++
|
||||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
# using Visual Studio C++
|
# using Visual Studio C++
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ include(pkgconfig_helper)
|
||||||
# module file.
|
# module file.
|
||||||
include(HandleFindGit2)
|
include(HandleFindGit2)
|
||||||
include(HandleFindLibDiveComputer)
|
include(HandleFindLibDiveComputer)
|
||||||
if(${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "DesktopExecutable")
|
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
|
||||||
include(HandleFindGrantlee)
|
include(HandleFindGrantlee)
|
||||||
include(HandleUserManual)
|
include(HandleUserManual)
|
||||||
endif()
|
endif()
|
||||||
|
@ -151,7 +151,7 @@ include_directories(.
|
||||||
# Project Target specific configuration should go here,
|
# Project Target specific configuration should go here,
|
||||||
# if the configuration is too big or would disrupt the normal code flux,
|
# if the configuration is too big or would disrupt the normal code flux,
|
||||||
# move it somewhere else (another file) and include it.
|
# move it somewhere else (another file) and include it.
|
||||||
if(${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "DesktopExecutable")
|
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
set(SUBSURFACE_TARGET Subsurface)
|
set(SUBSURFACE_TARGET Subsurface)
|
||||||
else()
|
else()
|
||||||
|
@ -160,7 +160,7 @@ if(${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "DesktopExecutable")
|
||||||
list(APPEND QT_EXTRA_COMPONENTS QuickWidgets)
|
list(APPEND QT_EXTRA_COMPONENTS QuickWidgets)
|
||||||
list(APPEND QT_EXTRA_LIBRARIES Qt5::QuickWidgets)
|
list(APPEND QT_EXTRA_LIBRARIES Qt5::QuickWidgets)
|
||||||
remove_definitions(-DSUBSURFACE_MOBILE)
|
remove_definitions(-DSUBSURFACE_MOBILE)
|
||||||
elseif(${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "MobileExecutable")
|
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
set(SUBSURFACE_TARGET Subsurface-mobile)
|
set(SUBSURFACE_TARGET Subsurface-mobile)
|
||||||
else()
|
else()
|
||||||
|
@ -204,7 +204,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${HID_LIB})
|
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${HID_LIB})
|
||||||
set(EXTRA_LIBS ${APP_SERVICES_LIBRARY})
|
set(EXTRA_LIBS ${APP_SERVICES_LIBRARY})
|
||||||
set(ICON_FILE ${CMAKE_SOURCE_DIR}/packaging/macosx/Subsurface.icns)
|
set(ICON_FILE ${CMAKE_SOURCE_DIR}/packaging/macosx/Subsurface.icns)
|
||||||
if(${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "MobileExecutable")
|
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
|
||||||
set(MACOSX_BUNDLE_INFO_STRING "Subsurface-mobile")
|
set(MACOSX_BUNDLE_INFO_STRING "Subsurface-mobile")
|
||||||
set(MACOSX_BUNDLE_BUNDLE_NAME "Subsurface-mobile")
|
set(MACOSX_BUNDLE_BUNDLE_NAME "Subsurface-mobile")
|
||||||
else()
|
else()
|
||||||
|
@ -242,7 +242,7 @@ set(QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt5::Test Qt5::QuickTest)
|
||||||
|
|
||||||
#disable bluetooth if Qt version is ancient.
|
#disable bluetooth if Qt version is ancient.
|
||||||
if (BTSUPPORT AND Qt5Widgets_VERSION VERSION_LESS 5.4.0)
|
if (BTSUPPORT AND Qt5Widgets_VERSION VERSION_LESS 5.4.0)
|
||||||
if (${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "MobileExecutable")
|
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
|
||||||
message(FATAL_ERROR "Subsurface-mobile requires BT and Qt version ${Qt5Widgets_VERSION} is too old for that")
|
message(FATAL_ERROR "Subsurface-mobile requires BT and Qt version ${Qt5Widgets_VERSION} is too old for that")
|
||||||
endif()
|
endif()
|
||||||
set(BTSUPPORT OFF)
|
set(BTSUPPORT OFF)
|
||||||
|
@ -253,11 +253,11 @@ endif()
|
||||||
# Windows Qt doesn't support BLE at all
|
# Windows Qt doesn't support BLE at all
|
||||||
# the rest of them need at least 5.6 to be reasonable but really, you want 5.9.1
|
# the rest of them need at least 5.6 to be reasonable but really, you want 5.9.1
|
||||||
if (BTSUPPORT AND NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
if (BTSUPPORT AND NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
if ("${Qt5Core_VERSION}" VERSION_LESS 5.6.0)
|
if (Qt5Core_VERSION VERSION_LESS 5.6.0)
|
||||||
message(STATUS "Turning off BLE support as Qt version ${Qt5Core_VERSION} is insufficient for that")
|
message(STATUS "Turning off BLE support as Qt version ${Qt5Core_VERSION} is insufficient for that")
|
||||||
else()
|
else()
|
||||||
set(BLESUPPORT ON)
|
set(BLESUPPORT ON)
|
||||||
if ("${Qt5Core_VERSION}" VERSION_LESS 5.9.1)
|
if (Qt5Core_VERSION VERSION_LESS 5.9.1)
|
||||||
message(STATUS "BLE support has been enabled, but for best results you really want Qt 5.9.1")
|
message(STATUS "BLE support has been enabled, but for best results you really want Qt 5.9.1")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -281,12 +281,12 @@ add_subdirectory(core)
|
||||||
add_subdirectory(qt-models)
|
add_subdirectory(qt-models)
|
||||||
add_subdirectory(profile-widget)
|
add_subdirectory(profile-widget)
|
||||||
|
|
||||||
if (${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "DesktopExecutable")
|
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
|
||||||
add_subdirectory(desktop-widgets)
|
add_subdirectory(desktop-widgets)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# create the executables
|
# create the executables
|
||||||
if(${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "MobileExecutable")
|
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
|
||||||
set(MOBILE_SRC
|
set(MOBILE_SRC
|
||||||
mobile-widgets/qmlmanager.cpp
|
mobile-widgets/qmlmanager.cpp
|
||||||
mobile-widgets/qmlprefs.cpp
|
mobile-widgets/qmlprefs.cpp
|
||||||
|
@ -328,7 +328,7 @@ if(${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "MobileExecutable")
|
||||||
subsurface_corelib
|
subsurface_corelib
|
||||||
${SUBSURFACE_LINK_LIBRARIES}
|
${SUBSURFACE_LINK_LIBRARIES}
|
||||||
)
|
)
|
||||||
elseif(${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "DesktopExecutable")
|
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
|
||||||
set(SUBSURFACE_APP
|
set(SUBSURFACE_APP
|
||||||
subsurface-desktop-main.cpp
|
subsurface-desktop-main.cpp
|
||||||
subsurface-helper.cpp
|
subsurface-helper.cpp
|
||||||
|
@ -397,11 +397,9 @@ if(NOT DEFINED QT_TRANSLATION_DIR OR QT_TRANSLATION_DIR STREQUAL "")
|
||||||
endif()
|
endif()
|
||||||
set(QTTRANSLATIONS "")
|
set(QTTRANSLATIONS "")
|
||||||
foreach(QTTRANSLATION ${QTTRANSLATIONS_BASE})
|
foreach(QTTRANSLATION ${QTTRANSLATIONS_BASE})
|
||||||
if(NOT ${QTTRANSLATION} STREQUAL "")
|
if (QTTRANSLATION AND EXISTS ${QT_TRANSLATION_DIR}/${QTTRANSLATION})
|
||||||
if(EXISTS ${QT_TRANSLATION_DIR}/${QTTRANSLATION})
|
|
||||||
set(QTTRANSLATIONS ${QTTRANSLATIONS} ${QT_TRANSLATION_DIR}/${QTTRANSLATION})
|
set(QTTRANSLATIONS ${QTTRANSLATIONS} ${QT_TRANSLATION_DIR}/${QTTRANSLATION})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# now for each platform the install instructions
|
# now for each platform the install instructions
|
||||||
|
@ -435,7 +433,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
install(FILES ${CMAKE_SOURCE_DIR}/gpl-2.0.txt DESTINATION ${RESOURCEDIR})
|
install(FILES ${CMAKE_SOURCE_DIR}/gpl-2.0.txt DESTINATION ${RESOURCEDIR})
|
||||||
install(CODE "execute_process(COMMAND mkdir -p ${RESOURCEDIR}/qml)")
|
install(CODE "execute_process(COMMAND mkdir -p ${RESOURCEDIR}/qml)")
|
||||||
# this is a HACK
|
# this is a HACK
|
||||||
if((${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "DesktopExecutable") AND (NOT NO_PRINTING))
|
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable" AND NOT NO_PRINTING)
|
||||||
install(DIRECTORY ${Grantlee5_DIR}/../../grantlee DESTINATION ${PLUGINDIR})
|
install(DIRECTORY ${Grantlee5_DIR}/../../grantlee DESTINATION ${PLUGINDIR})
|
||||||
endif()
|
endif()
|
||||||
install(CODE "execute_process(COMMAND mkdir -p ${PLUGINDIR}/geoservices)")
|
install(CODE "execute_process(COMMAND mkdir -p ${PLUGINDIR}/geoservices)")
|
||||||
|
@ -452,7 +450,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
# and with Qt 5.11 we need another library that isn't copied by macdeployqt
|
# and with Qt 5.11 we need another library that isn't copied by macdeployqt
|
||||||
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/lib/QtPositioningQuick.framework ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks)")
|
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/lib/QtPositioningQuick.framework ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks)")
|
||||||
endif()
|
endif()
|
||||||
if((${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "MobileExecutable"))
|
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
|
||||||
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtQuick ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
|
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtQuick ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
|
||||||
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtGraphicalEffects ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
|
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtGraphicalEffects ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
|
||||||
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtQml ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
|
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtQml ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
|
||||||
|
@ -525,7 +523,7 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
# in the filesystem below our install-root
|
# in the filesystem below our install-root
|
||||||
# different Linux flavors put the plugin in different directories
|
# different Linux flavors put the plugin in different directories
|
||||||
file(GLOB_RECURSE GOOGLEMAPS ${CMAKE_SOURCE_DIR}/../install-root/libqtgeoservices_googlemaps.so)
|
file(GLOB_RECURSE GOOGLEMAPS ${CMAKE_SOURCE_DIR}/../install-root/libqtgeoservices_googlemaps.so)
|
||||||
if ("${GOOGLEMAPS}" STREQUAL "")
|
if (NOT GOOGLEMAPS)
|
||||||
message(STATUS "Cannot find libqtgeoservices_googlemaps.so")
|
message(STATUS "Cannot find libqtgeoservices_googlemaps.so")
|
||||||
else()
|
else()
|
||||||
add_custom_target(link_googlemaps_plugin ALL COMMAND
|
add_custom_target(link_googlemaps_plugin ALL COMMAND
|
||||||
|
|
|
@ -35,11 +35,11 @@ set(SUBSURFACE_MOBILE_MODELS_LIB_SRCS
|
||||||
gpslistmodel.cpp
|
gpslistmodel.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if(${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "DesktopExecutable")
|
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
|
||||||
add_library(subsurface_models_desktop STATIC ${SUBSURFACE_GENERIC_MODELS_LIB_SRCS}
|
add_library(subsurface_models_desktop STATIC ${SUBSURFACE_GENERIC_MODELS_LIB_SRCS}
|
||||||
${SUBSURFACE_DESKTOP_MODELS_LIB_SRCS})
|
${SUBSURFACE_DESKTOP_MODELS_LIB_SRCS})
|
||||||
target_link_libraries(subsurface_models_desktop ${QT_LIBRARIES})
|
target_link_libraries(subsurface_models_desktop ${QT_LIBRARIES})
|
||||||
elseif(${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "MobileExecutable")
|
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
|
||||||
add_library(subsurface_models_mobile STATIC ${SUBSURFACE_GENERIC_MODELS_LIB_SRCS}
|
add_library(subsurface_models_mobile STATIC ${SUBSURFACE_GENERIC_MODELS_LIB_SRCS}
|
||||||
${SUBSURFACE_MOBILE_MODELS_LIB_SRCS})
|
${SUBSURFACE_MOBILE_MODELS_LIB_SRCS})
|
||||||
target_link_libraries(subsurface_models_mobile ${QT_LIBRARIES})
|
target_link_libraries(subsurface_models_mobile ${QT_LIBRARIES})
|
||||||
|
|
Loading…
Reference in a new issue