CMakeLists: Remove redundant spaces around CMake command calls

This commit is contained in:
Alex Turbov 2022-08-21 02:26:22 +04:00 committed by Brad King
parent a509602699
commit dd28d76203
4 changed files with 85 additions and 84 deletions

View File

@ -81,7 +81,7 @@ if(NOT DEFINED CMAKE_C_STANDARD AND NOT CMake_NO_C_STANDARD)
endif() endif()
endif() endif()
if(NOT DEFINED CMAKE_CXX_STANDARD AND NOT CMake_NO_CXX_STANDARD) if(NOT DEFINED CMAKE_CXX_STANDARD AND NOT CMake_NO_CXX_STANDARD)
if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.14) if(CMAKE_CXX_COMPILER_ID STREQUAL SunPro AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.14)
set(CMAKE_CXX_STANDARD 98) set(CMAKE_CXX_STANDARD 98)
else() else()
if(NOT CMAKE_VERSION VERSION_LESS 3.8) if(NOT CMAKE_VERSION VERSION_LESS 3.8)
@ -143,7 +143,7 @@ option(CMake_BUILD_DEVELOPER_REFERENCE
mark_as_advanced(CMake_BUILD_DEVELOPER_REFERENCE) mark_as_advanced(CMake_BUILD_DEVELOPER_REFERENCE)
# option to build using interprocedural optimizations (IPO/LTO) # option to build using interprocedural optimizations (IPO/LTO)
if (NOT CMAKE_VERSION VERSION_LESS 3.12.2) if(NOT CMAKE_VERSION VERSION_LESS 3.12.2)
option(CMake_BUILD_LTO "Compile CMake with link-time optimization if supported" OFF) option(CMake_BUILD_LTO "Compile CMake with link-time optimization if supported" OFF)
if(CMake_BUILD_LTO) if(CMake_BUILD_LTO)
include(CheckIPOSupported) include(CheckIPOSupported)
@ -344,7 +344,7 @@ endmacro()
# a macro to build the utilities used by CMake # a macro to build the utilities used by CMake
# Simply to improve readability of the main script. # Simply to improve readability of the main script.
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
macro (CMAKE_BUILD_UTILITIES) macro(CMAKE_BUILD_UTILITIES)
find_package(Threads) find_package(Threads)
# Suppress unnecessary checks in third-party code. # Suppress unnecessary checks in third-party code.
@ -400,7 +400,7 @@ macro (CMAKE_BUILD_UTILITIES)
# Setup third-party libraries. # Setup third-party libraries.
# Everything in the tree should be able to include files from the # Everything in the tree should be able to include files from the
# Utilities directory. # Utilities directory.
if ((CMAKE_SYSTEM_NAME STREQUAL "AIX" OR CMAKE_SYSTEM_NAME STREQUAL "OS400") AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if((CMAKE_SYSTEM_NAME STREQUAL "AIX" OR CMAKE_SYSTEM_NAME STREQUAL "OS400") AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# using -isystem option generate error "template with C linkage" # using -isystem option generate error "template with C linkage"
include_directories("${CMake_SOURCE_DIR}/Utilities/std") include_directories("${CMake_SOURCE_DIR}/Utilities/std")
else() else()
@ -408,7 +408,7 @@ macro (CMAKE_BUILD_UTILITIES)
endif() endif()
include_directories("${CMake_BINARY_DIR}/Utilities") include_directories("${CMake_BINARY_DIR}/Utilities")
if ((CMAKE_SYSTEM_NAME STREQUAL "AIX" OR CMAKE_SYSTEM_NAME STREQUAL "OS400") AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if((CMAKE_SYSTEM_NAME STREQUAL "AIX" OR CMAKE_SYSTEM_NAME STREQUAL "OS400") AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# using -isystem option generate error "template with C linkage" # using -isystem option generate error "template with C linkage"
include_directories("${CMake_SOURCE_DIR}/Utilities") include_directories("${CMake_SOURCE_DIR}/Utilities")
else() else()
@ -686,14 +686,14 @@ macro (CMAKE_BUILD_UTILITIES)
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# Use curses? # Use curses?
if(NOT DEFINED BUILD_CursesDialog) if(NOT DEFINED BUILD_CursesDialog)
if (UNIX) if(UNIX)
include(${CMake_SOURCE_DIR}/Source/Checks/Curses.cmake) include(${CMake_SOURCE_DIR}/Source/Checks/Curses.cmake)
set(BUILD_CursesDialog_DEFAULT "${CMakeCheckCurses_COMPILED}") set(BUILD_CursesDialog_DEFAULT "${CMakeCheckCurses_COMPILED}")
elseif(WIN32) elseif(WIN32)
set(BUILD_CursesDialog_DEFAULT "OFF") set(BUILD_CursesDialog_DEFAULT "OFF")
endif() endif()
option(BUILD_CursesDialog "Build the CMake Curses Dialog ccmake" "${BUILD_CursesDialog_DEFAULT}") option(BUILD_CursesDialog "Build the CMake Curses Dialog ccmake" "${BUILD_CursesDialog_DEFAULT}")
endif () endif()
if(BUILD_CursesDialog) if(BUILD_CursesDialog)
if(UNIX) if(UNIX)
set(CURSES_NEED_NCURSES TRUE) set(CURSES_NEED_NCURSES TRUE)
@ -718,10 +718,10 @@ macro (CMAKE_BUILD_UTILITIES)
if(NOT CMAKE_USE_SYSTEM_FORM) if(NOT CMAKE_USE_SYSTEM_FORM)
add_subdirectory(Source/CursesDialog/form) add_subdirectory(Source/CursesDialog/form)
elseif(NOT CURSES_FORM_LIBRARY) elseif(NOT CURSES_FORM_LIBRARY)
message( FATAL_ERROR "CMAKE_USE_SYSTEM_FORM in ON but CURSES_FORM_LIBRARY is not set!" ) message(FATAL_ERROR "CMAKE_USE_SYSTEM_FORM in ON but CURSES_FORM_LIBRARY is not set!")
endif() endif()
endif() endif()
endmacro () endmacro()
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
if(NOT CMake_TEST_EXTERNAL_CMAKE) if(NOT CMake_TEST_EXTERNAL_CMAKE)
@ -749,7 +749,7 @@ include(Source/CMakeVersion.cmake)
# Include the standard Dart testing module # Include the standard Dart testing module
enable_testing() enable_testing()
include (${CMAKE_ROOT}/Modules/Dart.cmake) include(${CMAKE_ROOT}/Modules/Dart.cmake)
# Set up test-time configuration. # Set up test-time configuration.
set_directory_properties(PROPERTIES set_directory_properties(PROPERTIES
@ -836,7 +836,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
add_custom_target(uninstall add_custom_target(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
include (CMakeCPack.cmake) include(CMakeCPack.cmake)
endif() endif()
@ -891,7 +891,8 @@ endif()
if(BUILD_TESTING) if(BUILD_TESTING)
add_test(SystemInformationNew "${CMAKE_CMAKE_COMMAND}" add_test(SystemInformationNew "${CMAKE_CMAKE_COMMAND}"
--system-information -G "${CMAKE_GENERATOR}" ) --system-information -G "${CMAKE_GENERATOR}"
)
endif() endif()
if(NOT CMake_TEST_EXTERNAL_CMAKE) if(NOT CMake_TEST_EXTERNAL_CMAKE)

View File

@ -4,7 +4,7 @@
# To ensure maximum portability across various compilers and platforms # To ensure maximum portability across various compilers and platforms
# deactivate any compiler extensions. Skip this for QNX, where additional # deactivate any compiler extensions. Skip this for QNX, where additional
# work is needed to build without compiler extensions. # work is needed to build without compiler extensions.
if (NOT CMAKE_SYSTEM_NAME STREQUAL "QNX") if(NOT CMAKE_SYSTEM_NAME STREQUAL "QNX")
set(CMAKE_C_EXTENSIONS FALSE) set(CMAKE_C_EXTENSIONS FALSE)
set(CMAKE_CXX_EXTENSIONS FALSE) set(CMAKE_CXX_EXTENSIONS FALSE)
endif() endif()
@ -760,7 +760,7 @@ if(APPLE)
endif() endif()
if (WIN32) if(WIN32)
set(SRCS ${SRCS} set(SRCS ${SRCS}
cmCallVisualStudioMacro.cxx cmCallVisualStudioMacro.cxx
cmCallVisualStudioMacro.h cmCallVisualStudioMacro.h
@ -824,7 +824,7 @@ if (WIN32)
# GetVersion to work properly on Windows 8 and above. # GetVersion to work properly on Windows 8 and above.
set(MANIFEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake.version.manifest) set(MANIFEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake.version.manifest)
endif() endif()
endif () endif()
# Watcom support # Watcom support
if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Darwin") if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Darwin")
@ -1084,7 +1084,7 @@ if(UNIX)
endif() endif()
endif() endif()
if (NOT FREEBSD_PKG_INCLUDE_DIRS OR NOT FREEBSD_PKG_LIBRARIES) if(NOT FREEBSD_PKG_INCLUDE_DIRS OR NOT FREEBSD_PKG_LIBRARIES)
message(FATAL_ERROR "CPack needs libpkg(3) to produce FreeBSD packages natively.") message(FATAL_ERROR "CPack needs libpkg(3) to produce FreeBSD packages natively.")
endif() endif()
else() else()
@ -1188,8 +1188,8 @@ if(BUILD_QtDialog)
add_subdirectory(QtDialog) add_subdirectory(QtDialog)
endif() endif()
include (${CMake_BINARY_DIR}/Source/LocalUserOptions.cmake OPTIONAL) include(${CMake_BINARY_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
include (${CMake_SOURCE_DIR}/Source/LocalUserOptions.cmake OPTIONAL) include(${CMake_SOURCE_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
if(WIN32) if(WIN32)
# Compute the binary version that appears in the RC file. Version # Compute the binary version that appears in the RC file. Version

View File

@ -3,7 +3,7 @@
project(QtDialog) project(QtDialog)
CMake_OPTIONAL_COMPONENT(cmake-gui) CMake_OPTIONAL_COMPONENT(cmake-gui)
set (QT_COMPONENTS set(QT_COMPONENTS
Core Core
Widgets Widgets
Gui Gui
@ -41,7 +41,7 @@ set(CMake_QT_EXTRA_LIBRARIES)
# Try to find the package WinExtras for the task bar progress # Try to find the package WinExtras for the task bar progress
if(WIN32) if(WIN32)
find_package(Qt${INSTALLED_QT_VERSION}WinExtras QUIET) find_package(Qt${INSTALLED_QT_VERSION}WinExtras QUIET)
if (Qt${INSTALLED_QT_VERSION}WinExtras_FOUND) if(Qt${INSTALLED_QT_VERSION}WinExtras_FOUND)
add_definitions(-DQT_WINEXTRAS) add_definitions(-DQT_WINEXTRAS)
list(APPEND CMake_QT_EXTRA_LIBRARIES Qt${INSTALLED_QT_VERSION}::WinExtras) list(APPEND CMake_QT_EXTRA_LIBRARIES Qt${INSTALLED_QT_VERSION}::WinExtras)
list(APPEND QT_COMPONENTS WinExtras) list(APPEND QT_COMPONENTS WinExtras)
@ -101,13 +101,13 @@ if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32))
endmacro() endmacro()
macro(install_qt_plugins _comps _plugins_var) macro(install_qt_plugins _comps _plugins_var)
foreach(_qt_comp IN LISTS ${_comps}) foreach(_qt_comp IN LISTS ${_comps})
if (INSTALLED_QT_VERSION VERSION_LESS 6) if(INSTALLED_QT_VERSION VERSION_LESS 6)
set(_qt_module_plugins ${Qt${INSTALLED_QT_VERSION}${_qt_comp}_PLUGINS}) set(_qt_module_plugins ${Qt${INSTALLED_QT_VERSION}${_qt_comp}_PLUGINS})
else() else()
get_target_property(_qt_module_plugins Qt${INSTALLED_QT_VERSION}::${_qt_comp} QT_PLUGINS) get_target_property(_qt_module_plugins Qt${INSTALLED_QT_VERSION}::${_qt_comp} QT_PLUGINS)
endif() endif()
foreach(_qt_plugin IN LISTS _qt_module_plugins) foreach(_qt_plugin IN LISTS _qt_module_plugins)
if (INSTALLED_QT_VERSION VERSION_GREATER_EQUAL 6) if(INSTALLED_QT_VERSION VERSION_GREATER_EQUAL 6)
# Qt6 provides the plugins as individual packages that need to be found. # Qt6 provides the plugins as individual packages that need to be found.
find_package(Qt${INSTALLED_QT_VERSION}${_qt_plugin} QUIET find_package(Qt${INSTALLED_QT_VERSION}${_qt_plugin} QUIET
PATHS ${Qt${INSTALLED_QT_VERSION}${_qt_comp}_DIR}) PATHS ${Qt${INSTALLED_QT_VERSION}${_qt_comp}_DIR})
@ -117,7 +117,7 @@ if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32))
endforeach() endforeach()
endmacro() endmacro()
if(APPLE) if(APPLE)
if (INSTALLED_QT_VERSION VERSION_EQUAL 5) if(INSTALLED_QT_VERSION VERSION_EQUAL 5)
install_qt_plugin("Qt5::QCocoaIntegrationPlugin" QT_PLUGINS) install_qt_plugin("Qt5::QCocoaIntegrationPlugin" QT_PLUGINS)
if(TARGET Qt5::QMacStylePlugin) if(TARGET Qt5::QMacStylePlugin)
install_qt_plugin("Qt5::QMacStylePlugin" QT_PLUGINS) install_qt_plugin("Qt5::QMacStylePlugin" QT_PLUGINS)
@ -132,7 +132,7 @@ if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32))
DESTINATION "${CMAKE_INSTALL_PREFIX}/Resources" DESTINATION "${CMAKE_INSTALL_PREFIX}/Resources"
${COMPONENT}) ${COMPONENT})
elseif(WIN32 AND NOT CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES) elseif(WIN32 AND NOT CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES)
if (INSTALLED_QT_VERSION VERSION_EQUAL 5) if(INSTALLED_QT_VERSION VERSION_EQUAL 5)
install_qt_plugin("Qt5::QWindowsIntegrationPlugin" QT_PLUGINS) install_qt_plugin("Qt5::QWindowsIntegrationPlugin" QT_PLUGINS)
else() else()
# FIXME: Minimize plugins for Qt6. # FIXME: Minimize plugins for Qt6.
@ -204,7 +204,7 @@ set(MOC_SRCS
) )
set(QRC_SRCS CMakeSetup.qrc) set(QRC_SRCS CMakeSetup.qrc)
if (INSTALLED_QT_VERSION VERSION_LESS 6) if(INSTALLED_QT_VERSION VERSION_LESS 6)
qt5_wrap_ui(UI_BUILT_SRCS ${UI_SRCS}) qt5_wrap_ui(UI_BUILT_SRCS ${UI_SRCS})
qt5_wrap_cpp(MOC_BUILT_SRCS ${MOC_SRCS}) qt5_wrap_cpp(MOC_BUILT_SRCS ${MOC_SRCS})
qt5_add_resources(QRC_BUILT_SRCS ${QRC_SRCS}) qt5_add_resources(QRC_BUILT_SRCS ${QRC_SRCS})
@ -215,15 +215,15 @@ else()
endif() endif()
add_library(CMakeGUIQRCLib OBJECT ${QRC_BUILT_SRCS}) add_library(CMakeGUIQRCLib OBJECT ${QRC_BUILT_SRCS})
if (FALSE) # CMake's bootstrap binary does not support automoc if(FALSE) # CMake's bootstrap binary does not support automoc
set(CMAKE_AUTOMOC 1) set(CMAKE_AUTOMOC 1)
set(CMAKE_AUTORCC 1) set(CMAKE_AUTORCC 1)
set(CMAKE_AUTOUIC 1) set(CMAKE_AUTOUIC 1)
else () else()
list(APPEND SRCS list(APPEND SRCS
${UI_BUILT_SRCS} ${UI_BUILT_SRCS}
${MOC_BUILT_SRCS}) ${MOC_BUILT_SRCS})
endif () endif()
if(USE_LGPL) if(USE_LGPL)
install(FILES ${CMake_SOURCE_DIR}/Licenses/LGPLv${USE_LGPL}.txt install(FILES ${CMake_SOURCE_DIR}/Licenses/LGPLv${USE_LGPL}.txt

View File

@ -89,7 +89,7 @@ if(BUILD_TESTING)
endif() endif()
endif() endif()
set(MAKE_IS_GNU ) set(MAKE_IS_GNU)
if(CMAKE_MAKE_PROGRAM MATCHES make) if(CMAKE_MAKE_PROGRAM MATCHES make)
execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} no_such_target --version execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} no_such_target --version
RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out) RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out)
@ -101,7 +101,7 @@ if(BUILD_TESTING)
endif() endif()
# some old versions of make simply cannot handle spaces in paths # some old versions of make simply cannot handle spaces in paths
if (MAKE_IS_GNU OR if(MAKE_IS_GNU OR
CMAKE_MAKE_PROGRAM MATCHES "nmake|gmake|wmake" OR CMAKE_MAKE_PROGRAM MATCHES "nmake|gmake|wmake" OR
CMAKE_GENERATOR MATCHES "Visual Studio|Xcode|Borland|Ninja") CMAKE_GENERATOR MATCHES "Visual Studio|Xcode|Borland|Ninja")
set(MAKE_SUPPORTS_SPACES 1) set(MAKE_SUPPORTS_SPACES 1)
@ -181,7 +181,7 @@ if(BUILD_TESTING)
ERROR_VARIABLE my_err) ERROR_VARIABLE my_err)
string(REGEX REPLACE "HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Wow6432Node\\\\Microsoft\\\\Windows CE Tools\\\\SDKs\\\\" ";" sdk_list "${sdk_reg}") string(REGEX REPLACE "HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Wow6432Node\\\\Microsoft\\\\Windows CE Tools\\\\SDKs\\\\" ";" sdk_list "${sdk_reg}")
list(LENGTH sdk_list sdk_list_len) list(LENGTH sdk_list sdk_list_len)
if (${sdk_list_len} GREATER 1) if(${sdk_list_len} GREATER 1)
list(GET sdk_list 1 _sdk) # The first entry is always empty due to the regex replace above list(GET sdk_list 1 _sdk) # The first entry is always empty due to the regex replace above
string(STRIP ${_sdk} _sdk) # Make sure there is no newline in the SDK name string(STRIP ${_sdk} _sdk) # Make sure there is no newline in the SDK name
endif() endif()
@ -287,12 +287,12 @@ if(BUILD_TESTING)
"Should the long tests be run (such as Bootstrap)." ON) "Should the long tests be run (such as Bootstrap)." ON)
mark_as_advanced(CMAKE_RUN_LONG_TESTS) mark_as_advanced(CMAKE_RUN_LONG_TESTS)
if (CMAKE_RUN_LONG_TESTS) if(CMAKE_RUN_LONG_TESTS)
option(CTEST_TEST_CTEST option(CTEST_TEST_CTEST
"Should the tests that run a full sub ctest process be run?" "Should the tests that run a full sub ctest process be run?"
OFF) OFF)
mark_as_advanced(CTEST_TEST_CTEST) mark_as_advanced(CTEST_TEST_CTEST)
endif () endif()
option(CTEST_TEST_CPACK option(CTEST_TEST_CPACK
"Should the tests that use '--build-target package' be run?" "Should the tests that use '--build-target package' be run?"
@ -367,9 +367,9 @@ if(BUILD_TESTING)
if(CMake_TEST_RESOURCES) if(CMake_TEST_RESOURCES)
ADD_TEST_MACRO(VSResource VSResource) ADD_TEST_MACRO(VSResource VSResource)
if (CMAKE_GENERATOR MATCHES "Ninja") if(CMAKE_GENERATOR MATCHES "Ninja")
add_test_macro(VSResourceNinjaForceRSP VSResourceNinjaForceRSP) add_test_macro(VSResourceNinjaForceRSP VSResourceNinjaForceRSP)
endif () endif()
endif() endif()
if(_isMultiConfig) if(_isMultiConfig)
set(MSManifest_CTEST_OPTIONS -C $<CONFIGURATION>) set(MSManifest_CTEST_OPTIONS -C $<CONFIGURATION>)
@ -499,7 +499,7 @@ if(BUILD_TESTING)
endif() endif()
ADD_TEST_MACRO(SourcesProperty SourcesProperty) ADD_TEST_MACRO(SourcesProperty SourcesProperty)
ADD_TEST_MACRO(SourceFileProperty SourceFileProperty) ADD_TEST_MACRO(SourceFileProperty SourceFileProperty)
if (NOT CMAKE_GENERATOR STREQUAL "Xcode") if(NOT CMAKE_GENERATOR STREQUAL "Xcode")
ADD_TEST_MACRO(SourceFileIncludeDirProperty SourceFileIncludeDirProperty) ADD_TEST_MACRO(SourceFileIncludeDirProperty SourceFileIncludeDirProperty)
endif() endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "LCC" OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" if(CMAKE_CXX_COMPILER_ID STREQUAL "LCC" OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
@ -646,11 +646,11 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(Module.WriteCompilerDetectionHeader WriteCompilerDetectionHeader) ADD_TEST_MACRO(Module.WriteCompilerDetectionHeader WriteCompilerDetectionHeader)
if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "LCC") if(APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "LCC")
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-fPIE run_pic_test) check_cxx_compiler_flag(-fPIE run_pic_test)
else() else()
if (CMAKE_CXX_COMPILER_ID MATCHES "PGI" if(CMAKE_CXX_COMPILER_ID MATCHES "PGI"
OR CMAKE_CXX_COMPILER_ID MATCHES "PathScale" OR CMAKE_CXX_COMPILER_ID MATCHES "PathScale"
OR CMAKE_CXX_COMPILER_ID MATCHES "Intel") OR CMAKE_CXX_COMPILER_ID MATCHES "Intel")
set(run_pic_test 0) set(run_pic_test 0)
@ -659,7 +659,7 @@ if(BUILD_TESTING)
endif() endif()
endif() endif()
if (run_pic_test) if(run_pic_test)
ADD_TEST_MACRO(PositionIndependentTargets PositionIndependentTargets) ADD_TEST_MACRO(PositionIndependentTargets PositionIndependentTargets)
endif() endif()
@ -793,7 +793,7 @@ if(BUILD_TESTING)
--build-exe-dir "${CMake_BINARY_DIR}/Tests/SubProject/foo" --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubProject/foo"
--test-command foo --test-command foo
) )
set_tests_properties ( SubProject-Stage2 PROPERTIES DEPENDS SubProject) set_tests_properties(SubProject-Stage2 PROPERTIES DEPENDS SubProject)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubProject") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubProject")
endif() endif()
@ -1352,7 +1352,7 @@ if(BUILD_TESTING)
--test-command complex) --test-command complex)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ComplexOneConfig") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ComplexOneConfig")
# because of the registry write these tests depend on each other # because of the registry write these tests depend on each other
set_tests_properties ( complex PROPERTIES DEPENDS complexOneConfig) set_tests_properties(complex PROPERTIES DEPENDS complexOneConfig)
add_test(Environment ${CMAKE_CTEST_COMMAND} add_test(Environment ${CMAKE_CTEST_COMMAND}
--build-and-test --build-and-test
@ -1540,7 +1540,7 @@ if(BUILD_TESTING)
# CMake_TEST_FindMatlab_MCR_ROOT_DIR: indicates an optional root directory for the MCR, required on Linux # CMake_TEST_FindMatlab_MCR_ROOT_DIR: indicates an optional root directory for the MCR, required on Linux
if(CMake_TEST_FindMatlab OR CMake_TEST_FindMatlab_ROOT_DIR OR if(CMake_TEST_FindMatlab OR CMake_TEST_FindMatlab_ROOT_DIR OR
CMake_TEST_FindMatlab_MCR OR CMake_TEST_FindMatlab_MCR_ROOT_DIR) CMake_TEST_FindMatlab_MCR OR CMake_TEST_FindMatlab_MCR_ROOT_DIR)
set(FindMatlab_additional_test_options ) set(FindMatlab_additional_test_options)
if(CMake_TEST_FindMatlab_MCR OR CMake_TEST_FindMatlab_MCR_ROOT_DIR) if(CMake_TEST_FindMatlab_MCR OR CMake_TEST_FindMatlab_MCR_ROOT_DIR)
set(FindMatlab_additional_test_options -DIS_MCR=TRUE) set(FindMatlab_additional_test_options -DIS_MCR=TRUE)
endif() endif()
@ -1673,7 +1673,8 @@ if(BUILD_TESTING)
RUN_SERIAL 1 RUN_SERIAL 1
TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT} TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}
WORKING_DIRECTORY ${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate WORKING_DIRECTORY ${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate
DEPENDS ExternalProjectUpdateSetup ) DEPENDS ExternalProjectUpdateSetup
)
execute_process( execute_process(
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
@ -1728,7 +1729,7 @@ if(BUILD_TESTING)
function(add_tutorial_test step_name use_mymath tutorial_arg pass_regex) function(add_tutorial_test step_name use_mymath tutorial_arg pass_regex)
set(tutorial_test_name Tutorial${step_name}) set(tutorial_test_name Tutorial${step_name})
set(tutorial_build_dir "${CMake_BINARY_DIR}/Tests/Tutorial/${step_name}") set(tutorial_build_dir "${CMake_BINARY_DIR}/Tests/Tutorial/${step_name}")
if (use_mymath) if(use_mymath)
set(tutorial_build_options "") set(tutorial_build_options "")
else() else()
set(tutorial_test_name ${tutorial_test_name}_MYMATH) set(tutorial_test_name ${tutorial_test_name}_MYMATH)
@ -1752,7 +1753,7 @@ if(BUILD_TESTING)
if(NOT CMake_TEST_EXTERNAL_CMAKE) if(NOT CMake_TEST_EXTERNAL_CMAKE)
foreach(STP RANGE 2 12) foreach(STP RANGE 2 12)
if (STP EQUAL 8) if(STP EQUAL 8)
set(pass_regex ".*using log and exp") set(pass_regex ".*using log and exp")
else() else()
set(pass_regex "The square root of 25 is 5") set(pass_regex "The square root of 25 is 5")
@ -2011,11 +2012,11 @@ if(BUILD_TESTING)
--test-command Exec2 --test-command Exec2
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LinkLineOrder") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LinkLineOrder")
set_tests_properties ( qtwrapping PROPERTIES DEPENDS wrapping) set_tests_properties(qtwrapping PROPERTIES DEPENDS wrapping)
set_tests_properties ( testdriver1 PROPERTIES DEPENDS qtwrapping) set_tests_properties(testdriver1 PROPERTIES DEPENDS qtwrapping)
set_tests_properties ( testdriver2 PROPERTIES DEPENDS testdriver1) set_tests_properties(testdriver2 PROPERTIES DEPENDS testdriver1)
set_tests_properties ( testdriver3 PROPERTIES DEPENDS testdriver2) set_tests_properties(testdriver3 PROPERTIES DEPENDS testdriver2)
set_tests_properties ( linkorder2 PROPERTIES DEPENDS linkorder1) set_tests_properties(linkorder2 PROPERTIES DEPENDS linkorder1)
# Test static linking on toolchains known to support it. # Test static linking on toolchains known to support it.
if((CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "LCC") if((CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "LCC")
@ -2047,9 +2048,9 @@ if(BUILD_TESTING)
"${CMake_BINARY_DIR}/Tests/SubDirSpaces/testfromsubdir.obj" "${CMake_BINARY_DIR}/Tests/SubDirSpaces/testfromsubdir.obj"
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDirSpaces") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDirSpaces")
endif () endif()
if (WIN32) if(WIN32)
add_test(SubDir ${CMAKE_CTEST_COMMAND} add_test(SubDir ${CMAKE_CTEST_COMMAND}
--build-and-test --build-and-test
"${CMake_SOURCE_DIR}/Tests/SubDir" "${CMake_SOURCE_DIR}/Tests/SubDir"
@ -2061,7 +2062,7 @@ if(BUILD_TESTING)
"${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere" "${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere"
"${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.obj" "${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.obj"
) )
else () else()
add_test(SubDir ${CMAKE_CTEST_COMMAND} add_test(SubDir ${CMAKE_CTEST_COMMAND}
--build-and-test --build-and-test
"${CMake_SOURCE_DIR}/Tests/SubDir" "${CMake_SOURCE_DIR}/Tests/SubDir"
@ -2073,7 +2074,7 @@ if(BUILD_TESTING)
"${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere" "${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere"
"${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.o" "${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.o"
) )
endif () endif()
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDir") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDir")
if(MSVC OR (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_SIMULATE_ID STREQUAL "MSVC")) if(MSVC OR (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_SIMULATE_ID STREQUAL "MSVC"))
@ -2106,7 +2107,7 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(ModuleDefinition example_exe) ADD_TEST_MACRO(ModuleDefinition example_exe)
endif() endif()
if (CMAKE_C_COMPILER_ID MATCHES "Watcom" AND WIN32) if(CMAKE_C_COMPILER_ID MATCHES "Watcom" AND WIN32)
ADD_TEST_MACRO(WatcomRuntimeLibrary) ADD_TEST_MACRO(WatcomRuntimeLibrary)
endif() endif()
@ -2321,7 +2322,7 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(VSNASM VSNASM) ADD_TEST_MACRO(VSNASM VSNASM)
endif() endif()
if (CMake_TEST_GreenHillsMULTI) if(CMake_TEST_GreenHillsMULTI)
macro(add_test_GhsMulti test_name test_dir bin_sub_dir build_opts) macro(add_test_GhsMulti test_name test_dir bin_sub_dir build_opts)
separate_arguments(_ghs_build_opts UNIX_COMMAND ${build_opts}) separate_arguments(_ghs_build_opts UNIX_COMMAND ${build_opts})
separate_arguments(_ghs_toolset_extra UNIX_COMMAND ${ghs_toolset_extra}) separate_arguments(_ghs_toolset_extra UNIX_COMMAND ${ghs_toolset_extra})
@ -2382,7 +2383,7 @@ if(BUILD_TESTING)
set(ghs_config_name "__default__") set(ghs_config_name "__default__")
endif() endif()
# test integrity build # test integrity build
if (NOT ghs_skip_integrity AND (NOT ghs_target_platform OR ghs_target_platform MATCHES "integrity")) if(NOT ghs_skip_integrity AND (NOT ghs_target_platform OR ghs_target_platform MATCHES "integrity"))
add_test_GhsMulti(integrityDDInt GhsMultiIntegrity/GhsMultiIntegrityDDInt "" "") add_test_GhsMulti(integrityDDInt GhsMultiIntegrity/GhsMultiIntegrityDDInt "" "")
add_test_GhsMulti(integrityMonolith GhsMultiIntegrity/GhsMultiIntegrityMonolith "" "") add_test_GhsMulti(integrityMonolith GhsMultiIntegrity/GhsMultiIntegrityMonolith "" "")
add_test_GhsMulti(integrityDD GhsMultiIntegrity/GhsMultiIntegrityDD "" "") add_test_GhsMulti(integrityDD GhsMultiIntegrity/GhsMultiIntegrityDD "" "")
@ -2464,8 +2465,8 @@ if(BUILD_TESTING)
add_test_VSAndroid(vs17 "Visual Studio 17 2022" "ARM") add_test_VSAndroid(vs17 "Visual Studio 17 2022" "ARM")
endif() endif()
if (APPLE) if(APPLE)
if (CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(BundleTestInstallDir set(BundleTestInstallDir
"${CMake_BINARY_DIR}/Tests/BundleTest/InstallDirectory") "${CMake_BINARY_DIR}/Tests/BundleTest/InstallDirectory")
add_test(BundleTest ${CMAKE_CTEST_COMMAND} add_test(BundleTest ${CMAKE_CTEST_COMMAND}
@ -2501,8 +2502,8 @@ if(BUILD_TESTING)
add_subdirectory(ObjC) add_subdirectory(ObjC)
add_subdirectory(ObjCXX) add_subdirectory(ObjCXX)
endif () endif()
endif () endif()
if(APPLE AND CTEST_TEST_CPACK) if(APPLE AND CTEST_TEST_CPACK)
add_test(BundleGeneratorTest ${CMAKE_CTEST_COMMAND} add_test(BundleGeneratorTest ${CMAKE_CTEST_COMMAND}
@ -3223,24 +3224,24 @@ if(BUILD_TESTING)
--output-log "${CMake_BINARY_DIR}/Tests/CTestTestFdSetSize/testOutput.log" --output-log "${CMake_BINARY_DIR}/Tests/CTestTestFdSetSize/testOutput.log"
) )
if (CMAKE_TESTS_CDASH_SERVER) if(CMAKE_TESTS_CDASH_SERVER)
set(regex "^([^:]+)://([^/]+)(.*)$") set(regex "^([^:]+)://([^/]+)(.*)$")
if ("${CMAKE_TESTS_CDASH_SERVER}" MATCHES "${regex}") if("${CMAKE_TESTS_CDASH_SERVER}" MATCHES "${regex}")
set(protocol "${CMAKE_MATCH_1}") set(protocol "${CMAKE_MATCH_1}")
set(server "${CMAKE_MATCH_2}") set(server "${CMAKE_MATCH_2}")
set(path "${CMAKE_MATCH_3}") set(path "${CMAKE_MATCH_3}")
else () else()
set(protocol "http") set(protocol "http")
set(server "open.cdash.org") set(server "open.cdash.org")
set(path "") set(path "")
message("warning: CMAKE_TESTS_CDASH_SERVER does not match expected regex...") message("warning: CMAKE_TESTS_CDASH_SERVER does not match expected regex...")
message(" ...using default url='${protocol}://${server}${path}' for CTestTest[23]") message(" ...using default url='${protocol}://${server}${path}' for CTestTest[23]")
endif () endif()
endif () endif()
if (CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS AND CMAKE_TESTS_CDASH_SERVER) if(CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS AND CMAKE_TESTS_CDASH_SERVER)
configure_file("${CMake_SOURCE_DIR}/Tests/CTestTest/test.cmake.in" configure_file("${CMake_SOURCE_DIR}/Tests/CTestTest/test.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestTest/test.cmake" @ONLY ESCAPE_QUOTES) "${CMake_BINARY_DIR}/Tests/CTestTest/test.cmake" @ONLY ESCAPE_QUOTES)
add_test(CTestTest ${CMAKE_CTEST_COMMAND} add_test(CTestTest ${CMAKE_CTEST_COMMAND}
@ -3282,19 +3283,19 @@ if(BUILD_TESTING)
# these tests take a long time, make sure they have it # these tests take a long time, make sure they have it
# if timeouts have not already been set # if timeouts have not already been set
get_test_property(CTestTest TIMEOUT PREVIOUS_TIMEOUT) get_test_property(CTestTest TIMEOUT PREVIOUS_TIMEOUT)
if ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) if("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
set_tests_properties ( CTestTest set_tests_properties(CTestTest
PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
endif () endif()
if(NOT CMake_TEST_EXTERNAL_CMAKE) if(NOT CMake_TEST_EXTERNAL_CMAKE)
get_test_property(CTestTest2 TIMEOUT PREVIOUS_TIMEOUT) get_test_property(CTestTest2 TIMEOUT PREVIOUS_TIMEOUT)
if("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) if("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
set_tests_properties ( CTestTest2 set_tests_properties(CTestTest2
PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
endif() endif()
endif() endif()
endif () endif()
if(CMake_TEST_EXTERNAL_CMAKE) if(CMake_TEST_EXTERNAL_CMAKE)
set(CMAKE_SKIP_BOOTSTRAP_TEST 1) set(CMAKE_SKIP_BOOTSTRAP_TEST 1)
@ -3330,10 +3331,9 @@ if(BUILD_TESTING)
# provide more time for the bootstrap test # provide more time for the bootstrap test
get_test_property(BootstrapTest TIMEOUT PREVIOUS_TIMEOUT) get_test_property(BootstrapTest TIMEOUT PREVIOUS_TIMEOUT)
if ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) if("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
set_tests_properties ( BootstrapTest set_tests_properties(BootstrapTest PROPERTIES TIMEOUT 5400)
PROPERTIES TIMEOUT 5400) endif()
endif ()
endif() endif()
if(CMAKE_Fortran_COMPILER) if(CMAKE_Fortran_COMPILER)
@ -3412,7 +3412,7 @@ if(BUILD_TESTING)
) )
# E2K has broken Java RVM before 3.5.2 # E2K has broken Java RVM before 3.5.2
if (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "e2k" AND _result EQUAL 0) if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "e2k" AND _result EQUAL 0)
string(REGEX MATCH "RVM ([0-9.]+)" RVMVER "${_version}") string(REGEX MATCH "RVM ([0-9.]+)" RVMVER "${_version}")
# Consider empty match a broken version too # Consider empty match a broken version too
if("${CMAKE_MATCH_1}" VERSION_LESS "3.5.2") if("${CMAKE_MATCH_1}" VERSION_LESS "3.5.2")
@ -3435,7 +3435,7 @@ if(BUILD_TESTING)
math(EXPR _object_mode "${CMAKE_SIZEOF_VOID_P} * 8") math(EXPR _object_mode "${CMAKE_SIZEOF_VOID_P} * 8")
if(_result EQUAL 0 AND _version MATCHES "${_object_mode}-Bit") if(_result EQUAL 0 AND _version MATCHES "${_object_mode}-Bit")
## next test is valid only if Java version is less than 1.10 ## next test is valid only if Java version is less than 1.10
if ("${Java_VERSION}" VERSION_LESS 1.10) if("${Java_VERSION}" VERSION_LESS 1.10)
add_test(NAME Java.Javah COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG> add_test(NAME Java.Javah COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
--build-and-test --build-and-test
"${CMake_SOURCE_DIR}/Tests/JavaJavah" "${CMake_SOURCE_DIR}/Tests/JavaJavah"
@ -3447,7 +3447,7 @@ if(BUILD_TESTING)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJavah") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJavah")
endif() endif()
## next test is valid only if Java is, at least, version 1.8 ## next test is valid only if Java is, at least, version 1.8
if (NOT "${Java_VERSION}" VERSION_LESS 1.8) if(NOT "${Java_VERSION}" VERSION_LESS 1.8)
add_test(NAME Java.NativeHeaders COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG> add_test(NAME Java.NativeHeaders COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
--build-and-test --build-and-test
"${CMake_SOURCE_DIR}/Tests/JavaNativeHeaders" "${CMake_SOURCE_DIR}/Tests/JavaNativeHeaders"
@ -3522,18 +3522,18 @@ if(BUILD_TESTING)
endif() endif()
if(CMAKE_TEST_PLPLOT_DIR) if(CMAKE_TEST_PLPLOT_DIR)
add_test(plplot ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_PLPLOT_DIR}/../../EasyDashboardScripts/plplot.cmake ) add_test(plplot ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_PLPLOT_DIR}/../../EasyDashboardScripts/plplot.cmake)
set_tests_properties ( plplot PROPERTIES TIMEOUT 5400) set_tests_properties ( plplot PROPERTIES TIMEOUT 5400)
endif() endif()
if(CMAKE_TEST_CHICKEN_DIR) if(CMAKE_TEST_CHICKEN_DIR)
add_test(Chicken ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_CHICKEN_DIR}/../../EasyDashboardScripts/Chicken.cmake ) add_test(Chicken ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_CHICKEN_DIR}/../../EasyDashboardScripts/Chicken.cmake)
set_tests_properties ( Chicken PROPERTIES TIMEOUT 5400) set_tests_properties(Chicken PROPERTIES TIMEOUT 5400)
endif() endif()
if(CMAKE_TEST_KDELIBS_ALPHA_1_DIR) if(CMAKE_TEST_KDELIBS_ALPHA_1_DIR)
add_test(KDELibsAlpha1 ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_KDELIBS_ALPHA_1_DIR}/../../EasyDashboardScripts/kdelibs.cmake ) add_test(KDELibsAlpha1 ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_KDELIBS_ALPHA_1_DIR}/../../EasyDashboardScripts/kdelibs.cmake)
set_tests_properties ( KDELibsAlpha1 PROPERTIES TIMEOUT 5400) set_tests_properties(KDELibsAlpha1 PROPERTIES TIMEOUT 5400)
endif() endif()
# Define a set of "contract" tests, each activated by a cache entry # Define a set of "contract" tests, each activated by a cache entry