summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/AndroidTestUtilities.cmake17
-rw-r--r--Modules/AndroidTestUtilities/PushToAndroidDevice.cmake6
-rw-r--r--Modules/AutogenInfo.cmake.in18
-rw-r--r--Modules/BundleUtilities.cmake58
-rw-r--r--Modules/CMakeAddFortranSubdirectory.cmake1
-rw-r--r--Modules/CMakeCSharpCompiler.cmake.in9
-rw-r--r--Modules/CMakeCSharpCompilerId.cs.in63
-rw-r--r--Modules/CMakeCSharpInformation.cmake119
-rw-r--r--Modules/CMakeCUDACompiler.cmake.in27
-rw-r--r--Modules/CMakeCUDACompilerABI.cu16
-rw-r--r--Modules/CMakeCUDACompilerId.cu.in50
-rw-r--r--Modules/CMakeCUDAInformation.cmake206
-rw-r--r--Modules/CMakeCXXCompiler.cmake.in1
-rw-r--r--Modules/CMakeCXXCompilerId.cpp.in4
-rw-r--r--Modules/CMakeCompilerIdDetection.cmake9
-rw-r--r--Modules/CMakeDetermineASMCompiler.cmake8
-rw-r--r--Modules/CMakeDetermineCSharpCompiler.cmake43
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake188
-rw-r--r--Modules/CMakeDetermineCompileFeatures.cmake6
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake22
-rw-r--r--Modules/CMakeExpandImportedTargets.cmake3
-rw-r--r--Modules/CMakeFindBinUtils.cmake1
-rw-r--r--Modules/CMakeGraphVizOptions.cmake13
-rw-r--r--Modules/CMakePackageConfigHelpers.cmake9
-rw-r--r--Modules/CMakeParseImplicitLinkInfo.cmake15
-rw-r--r--Modules/CMakePrintHelpers.cmake2
-rw-r--r--Modules/CMakeTestCSharpCompiler.cmake64
-rw-r--r--Modules/CMakeTestCUDACompiler.cmake76
-rwxr-xr-xModules/CPack.STGZ_Header.sh.in5
-rw-r--r--Modules/CPack.cmake4
-rw-r--r--Modules/CPackDeb.cmake15
-rw-r--r--Modules/CPackIFW.cmake179
-rw-r--r--Modules/CPackIFWConfigureFile.cmake65
-rw-r--r--Modules/CPackProductBuild.cmake20
-rw-r--r--Modules/CPackRPM.cmake361
-rw-r--r--Modules/CTestCoverageCollectGCOV.cmake1
-rw-r--r--Modules/CTestUseLaunchers.cmake4
-rw-r--r--Modules/CheckFunctionExists.c2
-rw-r--r--Modules/CheckFunctionExists.cmake30
-rw-r--r--Modules/Compiler/AppleClang-C.cmake12
-rw-r--r--Modules/Compiler/AppleClang-CXX.cmake21
-rw-r--r--Modules/Compiler/Clang-C.cmake12
-rw-r--r--Modules/Compiler/Clang-CXX-FeatureTests.cmake3
-rw-r--r--Modules/Compiler/Clang-CXX.cmake26
-rw-r--r--Modules/Compiler/GNU-C-DetermineCompiler.cmake (renamed from Modules/Compiler/GNU-DetermineCompiler.cmake)0
-rw-r--r--Modules/Compiler/GNU-C-FeatureTests.cmake10
-rw-r--r--Modules/Compiler/GNU-C.cmake23
-rw-r--r--Modules/Compiler/GNU-CXX-DetermineCompiler.cmake15
-rw-r--r--Modules/Compiler/GNU-CXX.cmake24
-rw-r--r--Modules/Compiler/Intel-C-FeatureTests.cmake9
-rw-r--r--Modules/Compiler/Intel-C.cmake28
-rw-r--r--Modules/Compiler/Intel-CXX-FeatureTests.cmake67
-rw-r--r--Modules/Compiler/Intel-CXX.cmake51
-rw-r--r--Modules/Compiler/MSVC-CXX.cmake10
-rw-r--r--Modules/Compiler/NVIDIA-CUDA.cmake27
-rw-r--r--Modules/Compiler/NVIDIA-DetermineCompiler.cmake17
-rw-r--r--Modules/Compiler/PGI-Fortran.cmake3
-rw-r--r--Modules/Compiler/SunPro-CXX.cmake12
-rw-r--r--Modules/CompilerId/VS-10.csproj.in55
-rw-r--r--Modules/CompilerId/VS-10.vcxproj.in3
-rw-r--r--Modules/ExternalData.cmake119
-rw-r--r--Modules/ExternalProject.cmake228
-rw-r--r--Modules/FeatureSummary.cmake345
-rw-r--r--Modules/FindALSA.cmake2
-rw-r--r--Modules/FindASPELL.cmake2
-rw-r--r--Modules/FindAVIFile.cmake2
-rw-r--r--Modules/FindArmadillo.cmake7
-rw-r--r--Modules/FindBISON.cmake4
-rw-r--r--Modules/FindBZip2.cmake2
-rw-r--r--Modules/FindBoost.cmake48
-rw-r--r--Modules/FindBullet.cmake2
-rw-r--r--Modules/FindCUDA/select_compute_arch.cmake21
-rw-r--r--Modules/FindCURL.cmake2
-rw-r--r--Modules/FindCoin3D.cmake4
-rw-r--r--Modules/FindCurses.cmake2
-rw-r--r--Modules/FindDart.cmake2
-rw-r--r--Modules/FindDevIL.cmake4
-rw-r--r--Modules/FindEXPAT.cmake2
-rw-r--r--Modules/FindFLEX.cmake4
-rw-r--r--Modules/FindFreetype.cmake3
-rw-r--r--Modules/FindGIF.cmake2
-rw-r--r--Modules/FindGSL.cmake3
-rw-r--r--Modules/FindGTK2.cmake89
-rw-r--r--Modules/FindGTest.cmake14
-rw-r--r--Modules/FindGettext.cmake2
-rw-r--r--Modules/FindGit.cmake5
-rw-r--r--Modules/FindGnuTLS.cmake3
-rw-r--r--Modules/FindGnuplot.cmake3
-rw-r--r--Modules/FindHDF5.cmake199
-rw-r--r--Modules/FindHSPELL.cmake3
-rw-r--r--Modules/FindHg.cmake2
-rw-r--r--Modules/FindICU.cmake1
-rw-r--r--Modules/FindIcotool.cmake2
-rw-r--r--Modules/FindJPEG.cmake2
-rw-r--r--Modules/FindJasper.cmake2
-rw-r--r--Modules/FindJava.cmake9
-rw-r--r--Modules/FindLATEX.cmake1
-rw-r--r--Modules/FindLTTngUST.cmake2
-rw-r--r--Modules/FindLibArchive.cmake8
-rw-r--r--Modules/FindLibXml2.cmake2
-rw-r--r--Modules/FindLua.cmake23
-rw-r--r--Modules/FindMPEG.cmake2
-rw-r--r--Modules/FindMPEG2.cmake3
-rw-r--r--Modules/FindMPI.cmake18
-rw-r--r--Modules/FindMotif.cmake3
-rw-r--r--Modules/FindOpenAL.cmake2
-rw-r--r--Modules/FindOpenGL.cmake61
-rw-r--r--Modules/FindOpenSSL.cmake13
-rw-r--r--Modules/FindOpenSceneGraph.cmake1
-rw-r--r--Modules/FindPNG.cmake4
-rw-r--r--Modules/FindPackageHandleStandardArgs.cmake1
-rw-r--r--Modules/FindPerl.cmake2
-rw-r--r--Modules/FindPerlLibs.cmake2
-rw-r--r--Modules/FindPhysFS.cmake3
-rw-r--r--Modules/FindPkgConfig.cmake8
-rw-r--r--Modules/FindProtobuf.cmake2
-rw-r--r--Modules/FindPythonInterp.cmake2
-rw-r--r--Modules/FindPythonLibs.cmake27
-rw-r--r--Modules/FindQuickTime.cmake2
-rw-r--r--Modules/FindSDL.cmake14
-rw-r--r--Modules/FindSDL_sound.cmake7
-rw-r--r--Modules/FindSquish.cmake3
-rw-r--r--Modules/FindTCL.cmake2
-rw-r--r--Modules/FindTIFF.cmake2
-rw-r--r--Modules/FindTclsh.cmake2
-rw-r--r--Modules/FindWget.cmake4
-rw-r--r--Modules/FindZLIB.cmake2
-rw-r--r--Modules/FortranCInterface.cmake3
-rw-r--r--Modules/FortranCInterface/CMakeLists.txt3
-rw-r--r--Modules/FortranCInterface/Detect.cmake3
-rw-r--r--Modules/GNUInstallDirs.cmake130
-rw-r--r--Modules/GenerateExportHeader.cmake1
-rw-r--r--Modules/GetPrerequisites.cmake20
-rw-r--r--Modules/InstallRequiredSystemLibraries.cmake32
-rw-r--r--Modules/Internal/FeatureTesting.cmake12
-rw-r--r--Modules/Platform/Android-Clang-ASM.cmake2
-rw-r--r--Modules/Platform/Android-Clang.cmake4
-rw-r--r--Modules/Platform/Android-Common.cmake9
-rw-r--r--Modules/Platform/Android/ndk-stl-c++.cmake5
-rw-r--r--Modules/Platform/Darwin-PGI-C.cmake2
-rw-r--r--Modules/Platform/Darwin-PGI-CXX.cmake2
-rw-r--r--Modules/Platform/Darwin-PGI-Fortran.cmake2
-rw-r--r--Modules/Platform/Darwin-PGI.cmake14
-rw-r--r--Modules/Platform/Darwin.cmake2
-rw-r--r--Modules/Platform/Fuchsia.cmake25
-rw-r--r--Modules/Platform/Windows-MSVC.cmake6
-rw-r--r--Modules/Platform/Windows-NVIDIA-CUDA.cmake46
-rw-r--r--Modules/Platform/Windows.cmake1
-rw-r--r--Modules/Qt4Macros.cmake2
-rw-r--r--Modules/UseJava.cmake2
-rw-r--r--Modules/UseSWIG.cmake81
-rw-r--r--Modules/WriteBasicConfigVersionFile.cmake2
-rw-r--r--Modules/WriteCompilerDetectionHeader.cmake130
153 files changed, 3044 insertions, 1039 deletions
diff --git a/Modules/AndroidTestUtilities.cmake b/Modules/AndroidTestUtilities.cmake
index a0a74fa..62d04f3 100644
--- a/Modules/AndroidTestUtilities.cmake
+++ b/Modules/AndroidTestUtilities.cmake
@@ -110,11 +110,18 @@ function(android_add_test_data test_name)
endforeach()
set(DATA_TARGET_NAME "${test_name}")
- ExternalData_Expand_Arguments(
- ${DATA_TARGET_NAME}
- extern_data_output
- ${AST_FILES})
- ExternalData_Add_Target(${DATA_TARGET_NAME})
+ string(FIND "${AST_FILES}" "DATA{" data_files_found)
+ if(${data_files_found} GREATER "-1")
+ # Use ExternalData if any DATA{} files were found.
+ ExternalData_Expand_Arguments(
+ ${DATA_TARGET_NAME}
+ extern_data_output
+ ${AST_FILES})
+ ExternalData_Add_Target(${DATA_TARGET_NAME})
+ else()
+ add_custom_target(${DATA_TARGET_NAME} ALL)
+ set(extern_data_output ${AST_FILES})
+ endif()
# For regular files on Linux, just copy them directly.
foreach(path ${AST_FILES})
diff --git a/Modules/AndroidTestUtilities/PushToAndroidDevice.cmake b/Modules/AndroidTestUtilities/PushToAndroidDevice.cmake
index f5f2564..04529b1 100644
--- a/Modules/AndroidTestUtilities/PushToAndroidDevice.cmake
+++ b/Modules/AndroidTestUtilities/PushToAndroidDevice.cmake
@@ -39,7 +39,9 @@ function(android_push_test_files_to_device)
# if(file_exists) will return true.
macro(check_device_file_exists device_file file_exists)
set(${file_exists} "")
- execute_adb_command(shell ls ${device_file})
+ execute_process(
+ COMMAND ${adb_executable} shell ls ${device_file}
+ OUTPUT_VARIABLE out_var ERROR_VARIABLE out_var)
if(NOT out_var) # when a directory exists but is empty the output is empty
set(${file_exists} "YES")
else()
@@ -117,7 +119,7 @@ function(android_push_test_files_to_device)
check_device_file_exists(${_ptd_DEV_TEST_DIR} test_dir_exists)
if(test_dir_exists)
# This is protected in the SetupProjectTests module.
- execute_adb_command(shell echo rm -r ${_ptd_DEV_TEST_DIR} | su)
+ execute_adb_command(shell rm -r ${_ptd_DEV_TEST_DIR})
endif()
execute_adb_command(shell mkdir -p ${_ptd_DEV_TEST_DIR})
diff --git a/Modules/AutogenInfo.cmake.in b/Modules/AutogenInfo.cmake.in
index 7d89420..3fafaff 100644
--- a/Modules/AutogenInfo.cmake.in
+++ b/Modules/AutogenInfo.cmake.in
@@ -1,12 +1,11 @@
-set(AM_SOURCES @_cpp_files@ )
-set(AM_RCC_SOURCES @_rcc_files@ )
-set(AM_RCC_INPUTS @_qt_rcc_inputs@)
-set(AM_SKIP_MOC @_skip_moc@ )
-set(AM_SKIP_UIC @_skip_uic@ )
-set(AM_HEADERS @_moc_headers@ )
+set(AM_SOURCES @_moc_uic_sources@)
+set(AM_HEADERS @_moc_uic_headers@)
+set(AM_SKIP_MOC @_skip_moc@)
+set(AM_SKIP_UIC @_skip_uic@)
set(AM_MOC_COMPILE_DEFINITIONS @_moc_compile_defs@)
set(AM_MOC_INCLUDES @_moc_incs@)
set(AM_MOC_OPTIONS @_moc_options@)
+set(AM_MOC_RELAXED_MODE "@_moc_relaxed_mode@")
set(AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE "@CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE@")
set(AM_CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@/")
set(AM_CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@/")
@@ -18,9 +17,10 @@ set(AM_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/")
set(AM_QT_VERSION_MAJOR "@_target_qt_version@")
set(AM_TARGET_NAME @_moc_target_name@)
set(AM_ORIGIN_TARGET_NAME @_origin_target_name@)
-set(AM_RELAXED_MODE "@_moc_relaxed_mode@")
set(AM_UIC_TARGET_OPTIONS @_uic_target_options@)
set(AM_UIC_OPTIONS_FILES @_qt_uic_options_files@)
set(AM_UIC_OPTIONS_OPTIONS @_qt_uic_options_options@)
-set(AM_RCC_OPTIONS_FILES @_qt_rcc_options_files@)
-set(AM_RCC_OPTIONS_OPTIONS @_qt_rcc_options_options@)
+set(AM_RCC_SOURCES @_rcc_files@ )
+set(AM_RCC_INPUTS @_rcc_inputs@)
+set(AM_RCC_OPTIONS_FILES @_rcc_options_files@)
+set(AM_RCC_OPTIONS_OPTIONS @_rcc_options_options@)
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
index b1610e2..5d6f402 100644
--- a/Modules/BundleUtilities.cmake
+++ b/Modules/BundleUtilities.cmake
@@ -624,6 +624,33 @@ function(get_bundle_keys app libs dirs keys_var)
endif()
endforeach()
+ # preserve library symlink structure
+ foreach(key ${${keys_var}})
+ if("${${key}_COPYFLAG}" STREQUAL 1)
+ if(IS_SYMLINK "${${key}_RESOLVED_ITEM}")
+ get_filename_component(target "${${key}_RESOLVED_ITEM}" REALPATH)
+ set_bundle_key_values(${keys_var} "${exe}" "${target}" "${exepath}" "${dirs}" 1 "${exe_rpaths}")
+ get_item_key("${target}" targetkey)
+
+ if(WIN32)
+ # ignore case on Windows
+ string(TOLOWER "${${key}_RESOLVED_ITEM}" resolved_item_compare)
+ string(TOLOWER "${${targetkey}_RESOLVED_EMBEDDED_ITEM}" resolved_embedded_item_compare)
+ else()
+ set(resolved_item_compare "${${key}_RESOLVED_ITEM}")
+ set(resolved_embedded_item_compare "${${targetkey}_RESOLVED_EMBEDDED_ITEM}")
+ endif()
+ get_filename_component(resolved_item_compare "${resolved_item_compare}" NAME)
+ get_filename_component(resolved_embedded_item_compare "${resolved_embedded_item_compare}" NAME)
+
+ if(NOT "${resolved_item_compare}" STREQUAL "${resolved_embedded_item_compare}")
+ set(${key}_COPYFLAG "2")
+ set(${key}_RESOLVED_ITEM "${${targetkey}_RESOLVED_EMBEDDED_ITEM}")
+ endif()
+
+ endif()
+ endif()
+ endforeach()
# Propagate values to caller's scope:
#
set(${keys_var} ${${keys_var}} PARENT_SCOPE)
@@ -640,6 +667,24 @@ function(get_bundle_keys app libs dirs keys_var)
endif()
endfunction()
+function(link_resolved_item_into_bundle resolved_item resolved_embedded_item)
+ if(WIN32)
+ # ignore case on Windows
+ string(TOLOWER "${resolved_item}" resolved_item_compare)
+ string(TOLOWER "${resolved_embedded_item}" resolved_embedded_item_compare)
+ else()
+ set(resolved_item_compare "${resolved_item}")
+ set(resolved_embedded_item_compare "${resolved_embedded_item}")
+ endif()
+
+ if("${resolved_item_compare}" STREQUAL "${resolved_embedded_item_compare}")
+ message(STATUS "warning: resolved_item == resolved_embedded_item - not linking...")
+ else()
+ get_filename_component(target_dir "${resolved_embedded_item}" DIRECTORY)
+ file(RELATIVE_PATH symlink_target "${target_dir}" "${resolved_item}")
+ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${symlink_target}" "${resolved_embedded_item}")
+ endif()
+endfunction()
function(copy_resolved_item_into_bundle resolved_item resolved_embedded_item)
if(WIN32)
@@ -854,7 +899,9 @@ function(fixup_bundle app libs dirs)
set(i 0)
foreach(key ${keys})
math(EXPR i ${i}+1)
- if(${${key}_COPYFLAG})
+ if("${${key}_COPYFLAG}" STREQUAL "2")
+ message(STATUS "${i}/${n}: linking '${${key}_RESOLVED_ITEM}' -> '${${key}_RESOLVED_EMBEDDED_ITEM}'")
+ elseif(${${key}_COPYFLAG})
message(STATUS "${i}/${n}: copying '${${key}_RESOLVED_ITEM}'")
else()
message(STATUS "${i}/${n}: *NOT* copying '${${key}_RESOLVED_ITEM}'")
@@ -872,7 +919,10 @@ function(fixup_bundle app libs dirs)
message(STATUS "")
endif()
- if(${${key}_COPYFLAG})
+ if("${${key}_COPYFLAG}" STREQUAL "2")
+ link_resolved_item_into_bundle("${${key}_RESOLVED_ITEM}"
+ "${${key}_RESOLVED_EMBEDDED_ITEM}")
+ elseif(${${key}_COPYFLAG})
set(item "${${key}_ITEM}")
if(item MATCHES "[^/]+\\.framework/")
copy_resolved_framework_into_bundle("${${key}_RESOLVED_ITEM}"
@@ -889,7 +939,9 @@ function(fixup_bundle app libs dirs)
math(EXPR i ${i}+1)
if(APPLE)
message(STATUS "${i}/${n}: fixing up '${${key}_RESOLVED_EMBEDDED_ITEM}'")
- fixup_bundle_item("${${key}_RESOLVED_EMBEDDED_ITEM}" "${exepath}" "${dirs}")
+ if(NOT "${${key}_COPYFLAG}" STREQUAL "2")
+ fixup_bundle_item("${${key}_RESOLVED_EMBEDDED_ITEM}" "${exepath}" "${dirs}")
+ endif()
else()
message(STATUS "${i}/${n}: fix-up not required on this platform '${${key}_RESOLVED_EMBEDDED_ITEM}'")
endif()
diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake
index 3b39bce..4649f35 100644
--- a/Modules/CMakeAddFortranSubdirectory.cmake
+++ b/Modules/CMakeAddFortranSubdirectory.cmake
@@ -45,7 +45,6 @@
set(_MS_MINGW_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR})
include(CheckLanguage)
include(ExternalProject)
-include(CMakeParseArguments)
function(_setup_mingw_config_and_build source_dir build_dir)
# Look for a MinGW gfortran.
diff --git a/Modules/CMakeCSharpCompiler.cmake.in b/Modules/CMakeCSharpCompiler.cmake.in
new file mode 100644
index 0000000..5ecc480
--- /dev/null
+++ b/Modules/CMakeCSharpCompiler.cmake.in
@@ -0,0 +1,9 @@
+set(CMAKE_CSharp_COMPILER "@CMAKE_CSharp_COMPILER@")
+set(CMAKE_CSharp_COMPILER_ID "@CMAKE_CSharp_COMPILER_ID@")
+set(CMAKE_CSharp_COMPILER_VERSION "@CMAKE_CSharp_COMPILER_VERSION@")
+
+set(CMAKE_CSharp_COMPILER_WORKS "@CMAKE_CSharp_COMPILER_WORKS@")
+
+set(CMAKE_CSharp_COMPILER_ID_RUN "@CMAKE_CSharp_COMPILER_ID_RUN@")
+set(CMAKE_CSharp_IGNORE_EXTENSIONS "inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC")
+set(CMAKE_CSharp_SOURCE_FILE_EXTENSIONS "cs")
diff --git a/Modules/CMakeCSharpCompilerId.cs.in b/Modules/CMakeCSharpCompilerId.cs.in
new file mode 100644
index 0000000..987f63a
--- /dev/null
+++ b/Modules/CMakeCSharpCompilerId.cs.in
@@ -0,0 +1,63 @@
+using System;
+
+namespace CSharp
+{
+ public class CSharpApp
+ {
+ const string InfoCompiler = "INFO:compiler[Microsoft "
+#if PlatformToolsetv100
+ + "Visual Studio"
+#elif PlatformToolsetv110
+ + "Visual Studio"
+#elif PlatformToolsetv120
+ + "Visual Studio"
+#elif PlatformToolsetv140
+ + "Visual Studio"
+#elif PlatformToolsetv141
+ + "Visual Studio"
+#else
+ + "unknown"
+#endif
+ + "]";
+
+ const string InfoPlatform = "INFO:platform[Windows]";
+
+ const string InfoArchitecture = "INFO:arch["
+#if Platformx64
+ + "x64"
+#elif Platformx86
+ + "x86"
+#elif PlatformxWin32
+ + "Win32]"
+#else
+ + "unknown"
+#endif
+ + "]";
+
+ const string InfoCompilerVersion = "INFO:compiler_version["
+#if PlatformToolsetv100
+ + "2010"
+#elif PlatformToolsetv110
+ + "2012"
+#elif PlatformToolsetv120
+ + "2013"
+#elif PlatformToolsetv140
+ + "2015"
+#elif PlatformToolsetv141
+ + "2017"
+#else
+ + "9999"
+#endif
+ + "]";
+
+ static void Main(string[] args)
+ {
+ // we have to print the lines to make sure
+ // the compiler does not optimize them away ...
+ System.Console.WriteLine(InfoCompiler);
+ System.Console.WriteLine(InfoPlatform);
+ System.Console.WriteLine(InfoArchitecture);
+ System.Console.WriteLine(InfoCompilerVersion);
+ }
+ }
+}
diff --git a/Modules/CMakeCSharpInformation.cmake b/Modules/CMakeCSharpInformation.cmake
new file mode 100644
index 0000000..dc775bd
--- /dev/null
+++ b/Modules/CMakeCSharpInformation.cmake
@@ -0,0 +1,119 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+# This file sets the basic flags for the C# language in CMake.
+# It also loads the available platform file for the system-compiler
+# if it exists.
+
+set(CMAKE_BASE_NAME)
+get_filename_component(CMAKE_BASE_NAME "${CMAKE_CSharp_COMPILER}" NAME_WE)
+
+set(CMAKE_BUILD_TYPE_INIT Debug)
+
+set(CMAKE_CSharp_FLAGS_INIT "/define:TRACE /langversion:3 /nowin32manifest")
+set(CMAKE_CSharp_FLAGS_DEBUG_INIT "/debug:full /optimize- /warn:3 /errorreport:prompt /define:DEBUG")
+set(CMAKE_CSharp_FLAGS_RELEASE_INIT "/debug:none /optimize /warn:1 /errorreport:queue")
+set(CMAKE_CSharp_FLAGS_RELWITHDEBINFO_INIT "/debug:full /optimize-")
+set(CMAKE_CSharp_FLAGS_MINSIZEREL_INIT "/debug:none /optimize")
+set(CMAKE_CSharp_LINKER_SUPPORTS_PDB ON)
+
+set(CMAKE_CSharp_STANDARD_LIBRARIES_INIT "System")
+
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set(CMAKE_CSharp_FLAGS_INIT "/platform:x86 ${CMAKE_CSharp_FLAGS_INIT}")
+else()
+ set(CMAKE_CSharp_FLAGS_INIT "/platform:x64 ${CMAKE_CSharp_FLAGS_INIT}")
+endif()
+
+# This should be included before the _INIT variables are
+# used to initialize the cache. Since the rule variables
+# have if blocks on them, users can still define them here.
+# But, it should still be after the platform file so changes can
+# be made to those values.
+
+# for most systems a module is the same as a shared library
+# so unless the variable CMAKE_MODULE_EXISTS is set just
+# copy the values from the LIBRARY variables
+if(NOT CMAKE_MODULE_EXISTS)
+ set(CMAKE_SHARED_MODULE_CSharp_FLAGS ${CMAKE_SHARED_LIBRARY_CSharp_FLAGS})
+ set(CMAKE_SHARED_MODULE_CREATE_CSharp_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_CSharp_FLAGS})
+endif()
+
+# add the flags to the cache based
+# on the initial values computed in the platform/*.cmake files
+# use _INIT variables so that this only happens the first time
+# and you can set these flags in the cmake cache
+set(CMAKE_CSharp_FLAGS_INIT "$ENV{CSharpFLAGS} ${CMAKE_CSharp_FLAGS_INIT}")
+# avoid just having a space as the initial value for the cache
+if(CMAKE_CSharp_FLAGS_INIT STREQUAL " ")
+ set(CMAKE_CSharp_FLAGS_INIT)
+endif()
+set (CMAKE_CSharp_FLAGS "${CMAKE_CSharp_FLAGS_INIT}" CACHE STRING
+ "Flags used by the C# compiler during all build types.")
+
+if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
+ set (CMAKE_CSharp_FLAGS_DEBUG "${CMAKE_CSharp_FLAGS_DEBUG_INIT}" CACHE STRING
+ "Flags used by the C# compiler during debug builds.")
+ set (CMAKE_CSharp_FLAGS_MINSIZEREL "${CMAKE_CSharp_FLAGS_MINSIZEREL_INIT}" CACHE STRING
+ "Flags used by the C# compiler during release builds for minimum size.")
+ set (CMAKE_CSharp_FLAGS_RELEASE "${CMAKE_CSharp_FLAGS_RELEASE_INIT}" CACHE STRING
+ "Flags used by the C# compiler during release builds.")
+ set (CMAKE_CSharp_FLAGS_RELWITHDEBINFO "${CMAKE_CSharp_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
+ "Flags used by the C# compiler during release builds with debug info.")
+endif()
+
+if(CMAKE_CSharp_STANDARD_LIBRARIES_INIT)
+ set(CMAKE_CSharp_STANDARD_LIBRARIES "${CMAKE_CSharp_STANDARD_LIBRARIES_INIT}"
+ CACHE STRING "Libraries linked by default with all C# applications.")
+ mark_as_advanced(CMAKE_CSharp_STANDARD_LIBRARIES)
+endif()
+
+# set missing flags (if they do not exist). This is needed in the
+# unlikely case that you have only C# and no C/C++ targets in your
+# project.
+if(NOT EXISTS CMAKE_SHARED_LINKER_FLAGS)
+ set(CMAKE_SHARED_LINKER_FLAGS "" CACHE STRING "" FORCE)
+endif()
+if(NOT EXISTS CMAKE_SHARED_LINKER_FLAGS_DEBUG)
+ set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "" CACHE STRING "" FORCE)
+endif()
+if(NOT EXISTS CMAKE_SHARED_LINKER_FLAGS_RELEASE)
+ set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "" CACHE STRING "" FORCE)
+endif()
+if(NOT EXISTS CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL)
+ set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "" CACHE STRING "" FORCE)
+endif()
+if(NOT EXISTS CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO)
+ set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "" CACHE STRING "" FORCE)
+endif()
+
+if(NOT EXISTS CMAKE_EXE_LINKER_FLAGS)
+ set(CMAKE_EXE_LINKER_FLAGS "" CACHE STRING "" FORCE)
+endif()
+if(NOT EXISTS CMAKE_EXE_LINKER_FLAGS_DEBUG)
+ set(CMAKE_EXE_LINKER_FLAGS_DEBUG "" CACHE STRING "" FORCE)
+endif()
+if(NOT EXISTS CMAKE_EXE_LINKER_FLAGS_RELEASE)
+ set(CMAKE_EXE_LINKER_FLAGS_RELEASE "" CACHE STRING "" FORCE)
+endif()
+if(NOT EXISTS CMAKE_EXE_LINKER_FLAGS_MINSIZEREL)
+ set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "" CACHE STRING "" FORCE)
+endif()
+if(NOT EXISTS CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO)
+ set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE STRING "" FORCE)
+endif()
+
+set(CMAKE_CSharp_CREATE_SHARED_LIBRARY "CSharp_NO_CREATE_SHARED_LIBRARY")
+set(CMAKE_CSharp_CREATE_SHARED_MODULE "CSharp_NO_CREATE_SHARED_MODULE")
+set(CMAKE_CSharp_LINK_EXECUTABLE "CSharp_NO_LINK_EXECUTABLE")
+
+mark_as_advanced(
+ CMAKE_CSharp_FLAGS
+ CMAKE_CSharp_FLAGS_RELEASE
+ CMAKE_CSharp_FLAGS_RELWITHDEBINFO
+ CMAKE_CSharp_FLAGS_MINSIZEREL
+ CMAKE_CSharp_FLAGS_DEBUG
+ )
+
+set(CMAKE_CSharp_USE_RESPONSE_FILE_FOR_OBJECTS 1)
+set(CMAKE_CSharp_INFORMATION_LOADED 1)
diff --git a/Modules/CMakeCUDACompiler.cmake.in b/Modules/CMakeCUDACompiler.cmake.in
new file mode 100644
index 0000000..f524e5f
--- /dev/null
+++ b/Modules/CMakeCUDACompiler.cmake.in
@@ -0,0 +1,27 @@
+set(CMAKE_CUDA_COMPILER "@CMAKE_CUDA_COMPILER@")
+set(CMAKE_CUDA_HOST_COMPILER "@CMAKE_CUDA_HOST_COMPILER@")
+set(CMAKE_CUDA_HOST_LINK_LAUNCHER "@CMAKE_CUDA_HOST_LINK_LAUNCHER@")
+set(CMAKE_CUDA_COMPILER_ID "@CMAKE_CUDA_COMPILER_ID@")
+set(CMAKE_CUDA_COMPILER_VERSION "@CMAKE_CUDA_COMPILER_VERSION@")
+set(CMAKE_CUDA_STANDARD_COMPUTED_DEFAULT "@CMAKE_CUDA_STANDARD_COMPUTED_DEFAULT@")
+set(CMAKE_CUDA_SIMULATE_ID "@CMAKE_CUDA_SIMULATE_ID@")
+set(CMAKE_CUDA_SIMULATE_VERSION "@CMAKE_CUDA_SIMULATE_VERSION@")
+@SET_MSVC_CUDA_ARCHITECTURE_ID@
+
+set(CMAKE_CUDA_COMPILER_ENV_VAR "CUDACXX")
+set(CMAKE_CUDA_HOST_COMPILER_ENV_VAR "CUDAHOSTCXX")
+
+set(CMAKE_CUDA_COMPILER_ID_RUN 1)
+set(CMAKE_CUDA_SOURCE_FILE_EXTENSIONS cu)
+set(CMAKE_CUDA_LINKER_PREFERENCE 15)
+set(CMAKE_CUDA_LINKER_PREFERENCE_PROPAGATES 1)
+
+set(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES "@CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES@")
+
+set(CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES@")
+set(CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES@")
+set(CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
+
+set(CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES "@CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES@")
+set(CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES@")
+set(CMAKE_CUDA_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CUDA_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
diff --git a/Modules/CMakeCUDACompilerABI.cu b/Modules/CMakeCUDACompilerABI.cu
new file mode 100644
index 0000000..99bacef
--- /dev/null
+++ b/Modules/CMakeCUDACompilerABI.cu
@@ -0,0 +1,16 @@
+#ifndef __CUDACC__
+#error "A C or C++ compiler has been selected for CUDA"
+#endif
+
+#include "CMakeCompilerABI.h"
+
+int main(int argc, char* argv[])
+{
+ int require = 0;
+ require += info_sizeof_dptr[argc];
+#if defined(ABI_ID)
+ require += info_abi[argc];
+#endif
+ (void)argv;
+ return require;
+}
diff --git a/Modules/CMakeCUDACompilerId.cu.in b/Modules/CMakeCUDACompilerId.cu.in
new file mode 100644
index 0000000..018bab7
--- /dev/null
+++ b/Modules/CMakeCUDACompilerId.cu.in
@@ -0,0 +1,50 @@
+#ifndef __CUDACC__
+# error "A C or C++ compiler has been selected for CUDA"
+#endif
+
+@CMAKE_CUDA_COMPILER_ID_CONTENT@
+
+/* Construct the string literal in pieces to prevent the source from
+ getting matched. Store it in a pointer rather than an array
+ because some compilers will just produce instructions to fill the
+ array rather than assigning a pointer to a static array. */
+char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
+#ifdef SIMULATE_ID
+char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
+#endif
+
+@CMAKE_CUDA_COMPILER_ID_PLATFORM_CONTENT@
+@CMAKE_CUDA_COMPILER_ID_ERROR_FOR_TEST@
+
+const char* info_language_dialect_default = "INFO" ":" "dialect_default["
+#if __cplusplus > 201402L
+ "17"
+#elif __cplusplus >= 201402L
+ "14"
+#elif __cplusplus >= 201103L
+ "11"
+#else
+ "98"
+#endif
+"]";
+
+/*--------------------------------------------------------------------------*/
+
+int main(int argc, char* argv[])
+{
+ int require = 0;
+ require += info_compiler[argc];
+ require += info_platform[argc];
+#ifdef COMPILER_VERSION_MAJOR
+ require += info_version[argc];
+#endif
+#ifdef SIMULATE_ID
+ require += info_simulate[argc];
+#endif
+#ifdef SIMULATE_VERSION_MAJOR
+ require += info_simulate_version[argc];
+#endif
+ require += info_language_dialect_default[argc];
+ (void)argv;
+ return require;
+}
diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake
new file mode 100644
index 0000000..1c48159
--- /dev/null
+++ b/Modules/CMakeCUDAInformation.cmake
@@ -0,0 +1,206 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+if(UNIX)
+ set(CMAKE_CUDA_OUTPUT_EXTENSION .o)
+else()
+ set(CMAKE_CUDA_OUTPUT_EXTENSION .obj)
+endif()
+set(CMAKE_INCLUDE_FLAG_CUDA "-I")
+
+# Load compiler-specific information.
+if(CMAKE_CUDA_COMPILER_ID)
+ include(Compiler/${CMAKE_CUDA_COMPILER_ID}-CUDA OPTIONAL)
+endif()
+
+# load the system- and compiler specific files
+if(CMAKE_CUDA_COMPILER_ID)
+ # load a hardware specific file, mostly useful for embedded compilers
+ if(CMAKE_SYSTEM_PROCESSOR)
+ include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_CUDA_COMPILER_ID}-CUDA-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
+ endif()
+ include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_CUDA_COMPILER_ID}-CUDA OPTIONAL)
+endif()
+
+
+if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CUDA_FLAG)
+ set(CMAKE_SHARED_LIBRARY_RUNTIME_CUDA_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG})
+endif()
+
+if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CUDA_FLAG_SEP)
+ set(CMAKE_SHARED_LIBRARY_RUNTIME_CUDA_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP})
+endif()
+
+if(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_CUDA_FLAG)
+ set(CMAKE_SHARED_LIBRARY_RPATH_LINK_CUDA_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG})
+endif()
+
+if(NOT DEFINED CMAKE_EXE_EXPORTS_CUDA_FLAG)
+ set(CMAKE_EXE_EXPORTS_CUDA_FLAG ${CMAKE_EXE_EXPORTS_C_FLAG})
+endif()
+
+if(NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_CUDA_FLAG)
+ set(CMAKE_SHARED_LIBRARY_SONAME_CUDA_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG})
+endif()
+
+if(NOT CMAKE_EXECUTABLE_RUNTIME_CUDA_FLAG)
+ set(CMAKE_EXECUTABLE_RUNTIME_CUDA_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_CUDA_FLAG})
+endif()
+
+if(NOT CMAKE_EXECUTABLE_RUNTIME_CUDA_FLAG_SEP)
+ set(CMAKE_EXECUTABLE_RUNTIME_CUDA_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_CUDA_FLAG_SEP})
+endif()
+
+if(NOT CMAKE_EXECUTABLE_RPATH_LINK_CUDA_FLAG)
+ set(CMAKE_EXECUTABLE_RPATH_LINK_CUDA_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_CUDA_FLAG})
+endif()
+
+if(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_CUDA_WITH_RUNTIME_PATH)
+ set(CMAKE_SHARED_LIBRARY_LINK_CUDA_WITH_RUNTIME_PATH ${CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH})
+endif()
+
+
+# for most systems a module is the same as a shared library
+# so unless the variable CMAKE_MODULE_EXISTS is set just
+# copy the values from the LIBRARY variables
+if(NOT CMAKE_MODULE_EXISTS)
+ set(CMAKE_SHARED_MODULE_CUDA_FLAGS ${CMAKE_SHARED_LIBRARY_CUDA_FLAGS})
+ set(CMAKE_SHARED_MODULE_CREATE_CUDA_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS})
+endif()
+
+# add the flags to the cache based
+# on the initial values computed in the platform/*.cmake files
+# use _INIT variables so that this only happens the first time
+# and you can set these flags in the cmake cache
+set(CMAKE_CUDA_FLAGS_INIT "$ENV{CUDAFLAGS} ${CMAKE_CUDA_FLAGS_INIT}")
+
+foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO)
+ string(STRIP "${CMAKE_CUDA_FLAGS${c}_INIT}" CMAKE_CUDA_FLAGS${c}_INIT)
+endforeach()
+
+set (CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS_INIT}" CACHE STRING
+ "Flags used by the compiler during all build types.")
+
+if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
+ set (CMAKE_CUDA_FLAGS_DEBUG "${CMAKE_CUDA_FLAGS_DEBUG_INIT}" CACHE STRING
+ "Flags used by the compiler during debug builds.")
+ set (CMAKE_CUDA_FLAGS_MINSIZEREL "${CMAKE_CUDA_FLAGS_MINSIZEREL_INIT}" CACHE STRING
+ "Flags used by the compiler during release builds for minimum size.")
+ set (CMAKE_CUDA_FLAGS_RELEASE "${CMAKE_CUDA_FLAGS_RELEASE_INIT}" CACHE STRING
+ "Flags used by the compiler during release builds.")
+ set (CMAKE_CUDA_FLAGS_RELWITHDEBINFO "${CMAKE_CUDA_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
+ "Flags used by the compiler during release builds with debug info.")
+
+endif()
+
+if(CMAKE_CUDA_STANDARD_LIBRARIES_INIT)
+ set(CMAKE_CUDA_STANDARD_LIBRARIES "${CMAKE_CUDA_STANDARD_LIBRARIES_INIT}"
+ CACHE STRING "Libraries linked by default with all CUDA applications.")
+ mark_as_advanced(CMAKE_CUDA_STANDARD_LIBRARIES)
+endif()
+
+include(CMakeCommonLanguageInclude)
+
+# now define the following rules:
+# CMAKE_CUDA_CREATE_SHARED_LIBRARY
+# CMAKE_CUDA_CREATE_SHARED_MODULE
+# CMAKE_CUDA_COMPILE_OBJECT
+# CMAKE_CUDA_LINK_EXECUTABLE
+
+if(CMAKE_CUDA_HOST_COMPILER)
+ set(CMAKE_CUDA_HOST_FLAGS "-ccbin=<CMAKE_CUDA_HOST_COMPILER>")
+else()
+ set(CMAKE_CUDA_HOST_FLAGS "")
+endif()
+
+set(__IMPLICT_LINKS )
+foreach(dir ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES})
+ string(APPEND __IMPLICT_LINKS " -L\"${dir}\"")
+endforeach()
+foreach(lib ${CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES})
+ if(${lib} MATCHES "/")
+ string(APPEND __IMPLICT_LINKS " \"${lib}\"")
+ else()
+ string(APPEND __IMPLICT_LINKS " -l${lib}")
+ endif()
+endforeach()
+
+# create a shared library
+if(NOT CMAKE_CUDA_CREATE_SHARED_LIBRARY)
+ set(CMAKE_CUDA_CREATE_SHARED_LIBRARY
+ "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>${__IMPLICT_LINKS}")
+endif()
+
+# create a shared module copy the shared library rule by default
+if(NOT CMAKE_CUDA_CREATE_SHARED_MODULE)
+ set(CMAKE_CUDA_CREATE_SHARED_MODULE ${CMAKE_CUDA_CREATE_SHARED_LIBRARY})
+endif()
+
+# Create a static archive incrementally for large object file counts.
+if(NOT DEFINED CMAKE_CUDA_ARCHIVE_CREATE)
+ set(CMAKE_CUDA_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
+endif()
+if(NOT DEFINED CMAKE_CUDA_ARCHIVE_APPEND)
+ set(CMAKE_CUDA_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
+endif()
+if(NOT DEFINED CMAKE_CUDA_ARCHIVE_FINISH)
+ set(CMAKE_CUDA_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
+endif()
+
+#Specify how to compile when ptx has been requested
+if(NOT CMAKE_CUDA_COMPILE_PTX_COMPILATION)
+ set(CMAKE_CUDA_COMPILE_PTX_COMPILATION
+ "<CMAKE_CUDA_COMPILER> ${CMAKE_CUDA_HOST_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -x cu -ptx <SOURCE> -o <OBJECT>")
+endif()
+
+#Specify how to compile when separable compilation has been requested
+if(NOT CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION)
+ set(CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION
+ "<CMAKE_CUDA_COMPILER> ${CMAKE_CUDA_HOST_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -x cu -dc <SOURCE> -o <OBJECT>")
+endif()
+
+#Specify how to compile when whole compilation has been requested
+if(NOT CMAKE_CUDA_COMPILE_WHOLE_COMPILATION)
+ set(CMAKE_CUDA_COMPILE_WHOLE_COMPILATION
+ "<CMAKE_CUDA_COMPILER> ${CMAKE_CUDA_HOST_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -x cu -c <SOURCE> -o <OBJECT>")
+endif()
+
+if(CMAKE_GENERATOR STREQUAL "Ninja")
+ set(CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION
+ "<CMAKE_CUDA_COMPILER> ${CMAKE_CUDA_HOST_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -x cu -M <SOURCE> -MT <OBJECT> -o $DEP_FILE")
+ #The Ninja generator uses the make file dependency files to determine what
+ #files need to be recompiled. Unfortunately, nvcc doesn't support building
+ #a source file and generating the dependencies of said file in a single
+ #invocation. Instead we have to state that you need to chain two commands.
+ #
+ #The makefile generators uses the custom CMake dependency scanner, and thus
+ #it is exempt from this logic.
+ list(APPEND CMAKE_CUDA_COMPILE_PTX_COMPILATION "${CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION}")
+ list(APPEND CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION "${CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION}")
+ list(APPEND CMAKE_CUDA_COMPILE_WHOLE_COMPILATION "${CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION}")
+endif()
+
+# compile a cu file into an executable
+if(NOT CMAKE_CUDA_LINK_EXECUTABLE)
+ set(CMAKE_CUDA_LINK_EXECUTABLE
+ "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_CUDA_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_LINKS}")
+endif()
+
+#These are used when linking relocatable (dc) cuda code
+if(NOT CMAKE_CUDA_DEVICE_LINK_LIBRARY)
+ set(CMAKE_CUDA_DEVICE_LINK_LIBRARY
+ "<CMAKE_CUDA_COMPILER> <CMAKE_CUDA_LINK_FLAGS> <LANGUAGE_COMPILE_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
+endif()
+if(NOT CMAKE_CUDA_DEVICE_LINK_EXECUTABLE)
+ set(CMAKE_CUDA_DEVICE_LINK_EXECUTABLE
+ "<CMAKE_CUDA_COMPILER> <FLAGS> <CMAKE_CUDA_LINK_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
+endif()
+
+mark_as_advanced(
+CMAKE_CUDA_FLAGS
+CMAKE_CUDA_FLAGS_RELEASE
+CMAKE_CUDA_FLAGS_RELWITHDEBINFO
+CMAKE_CUDA_FLAGS_MINSIZEREL
+CMAKE_CUDA_FLAGS_DEBUG)
+
+set(CMAKE_CUDA_INFORMATION_LOADED 1)
diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in
index c295b74..6d56488 100644
--- a/Modules/CMakeCXXCompiler.cmake.in
+++ b/Modules/CMakeCXXCompiler.cmake.in
@@ -8,6 +8,7 @@ set(CMAKE_CXX_COMPILE_FEATURES "@CMAKE_CXX_COMPILE_FEATURES@")
set(CMAKE_CXX98_COMPILE_FEATURES "@CMAKE_CXX98_COMPILE_FEATURES@")
set(CMAKE_CXX11_COMPILE_FEATURES "@CMAKE_CXX11_COMPILE_FEATURES@")
set(CMAKE_CXX14_COMPILE_FEATURES "@CMAKE_CXX14_COMPILE_FEATURES@")
+set(CMAKE_CXX17_COMPILE_FEATURES "@CMAKE_CXX17_COMPILE_FEATURES@")
set(CMAKE_CXX_PLATFORM_ID "@CMAKE_CXX_PLATFORM_ID@")
set(CMAKE_CXX_SIMULATE_ID "@CMAKE_CXX_SIMULATE_ID@")
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index 3e5c0fc..9aa096d 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -28,7 +28,9 @@ char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
@CMAKE_CXX_COMPILER_ID_ERROR_FOR_TEST@
const char* info_language_dialect_default = "INFO" ":" "dialect_default["
-#if __cplusplus >= 201402L
+#if __cplusplus > 201402L
+ "17"
+#elif __cplusplus >= 201402L
"14"
#elif __cplusplus >= 201103L
"11"
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
index 4732250..7ca79bd 100644
--- a/Modules/CMakeCompilerIdDetection.cmake
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -11,11 +11,9 @@ function(_readFile file)
set(_compiler_id_pp_test_${CompilerId} ${_compiler_id_pp_test} PARENT_SCOPE)
endfunction()
-include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
-
function(compiler_id_detection outvar lang)
- if (NOT lang STREQUAL Fortran)
+ if (NOT lang STREQUAL Fortran AND NOT lang STREQUAL CSharp)
file(GLOB lang_files
"${CMAKE_ROOT}/Modules/Compiler/*-DetermineCompiler.cmake")
set(nonlang CXX)
@@ -90,6 +88,11 @@ function(compiler_id_detection outvar lang)
list(APPEND ordered_compilers
MIPSpro)
+ #Currently the only CUDA compilers are NVIDIA
+ if(lang STREQUAL CUDA)
+ set(ordered_compilers NVIDIA)
+ endif()
+
if(CID_ID_DEFINE)
foreach(Id ${ordered_compilers})
set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}# define ${CID_PREFIX}COMPILER_IS_${Id} 0\n")
diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake
index deb10fb..4162726 100644
--- a/Modules/CMakeDetermineASMCompiler.cmake
+++ b/Modules/CMakeDetermineASMCompiler.cmake
@@ -9,7 +9,13 @@ include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
# prefer the environment variable ASM
if(NOT $ENV{ASM${ASM_DIALECT}} STREQUAL "")
- set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT "$ENV{ASM${ASM_DIALECT}}")
+ get_filename_component(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT $ENV{ASM${ASM_DIALECT}} PROGRAM PROGRAM_ARGS CMAKE_ASM${ASM_DIALECT}_FLAGS_ENV_INIT)
+ if(CMAKE_ASM${ASM_DIALECT}_FLAGS_ENV_INIT)
+ set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ARG1 "${CMAKE_ASM${ASM_DIALECT}_FLAGS_ENV_INIT}" CACHE STRING "First argument to ASM${ASM_DIALECT} compiler")
+ endif()
+ if(NOT EXISTS ${CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT})
+ message(FATAL_ERROR "Could not find compiler set in environment variable ASM${ASM_DIALECT}:\n$ENV{ASM${ASM_DIALECT}}.")
+ endif()
endif()
# finally list compilers to try
diff --git a/Modules/CMakeDetermineCSharpCompiler.cmake b/Modules/CMakeDetermineCSharpCompiler.cmake
new file mode 100644
index 0000000..1b8dd02
--- /dev/null
+++ b/Modules/CMakeDetermineCSharpCompiler.cmake
@@ -0,0 +1,43 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+if(NOT ${CMAKE_GENERATOR} MATCHES "Visual Studio ([^789]|[789][0-9])")
+ message(FATAL_ERROR
+ "C# is currently only supported for Microsoft Visual Studio 2010 and later.")
+endif()
+
+include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
+#include(Platform/${CMAKE_SYSTEM_NAME}-Determine-CSharp OPTIONAL)
+#include(Platform/${CMAKE_SYSTEM_NAME}-CSharp OPTIONAL)
+if(NOT CMAKE_CSharp_COMPILER_NAMES)
+ set(CMAKE_CSharp_COMPILER_NAMES csc)
+endif()
+
+# Build a small source file to identify the compiler.
+if(NOT CMAKE_CSharp_COMPILER_ID_RUN)
+ set(CMAKE_CSharp_COMPILER_ID_RUN 1)
+
+ # Try to identify the compiler.
+ set(CMAKE_CSharp_COMPILER_ID_STRINGS_PARAMETERS ENCODING UTF-16LE)
+ set(CMAKE_CSharp_COMPILER_ID)
+ include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
+ CMAKE_DETERMINE_COMPILER_ID(CSharp CSFLAGS CMakeCSharpCompilerId.cs)
+
+ execute_process(COMMAND "${CMAKE_CSharp_COMPILER}" "/help" OUTPUT_VARIABLE output)
+ string(REPLACE "\n" ";" output "${output}")
+ foreach(line ${output})
+ string(TOUPPER ${line} line)
+ string(REGEX REPLACE "^.*COMPILER.*VERSION[^\\.0-9]*([\\.0-9]+).*$" "\\1" version "${line}")
+ if(version AND NOT "x${line}" STREQUAL "x${version}")
+ set(CMAKE_CSharp_COMPILER_VERSION ${version})
+ break()
+ endif()
+ endforeach()
+ message(STATUS "The CSharp compiler version is ${CMAKE_CSharp_COMPILER_VERSION}")
+endif()
+
+# configure variables set in this file for fast reload later on
+configure_file(${CMAKE_ROOT}/Modules/CMakeCSharpCompiler.cmake.in
+ ${CMAKE_PLATFORM_INFO_DIR}/CMakeCSharpCompiler.cmake
+ @ONLY
+ )
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
new file mode 100644
index 0000000..7b6d17b
--- /dev/null
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -0,0 +1,188 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
+include(${CMAKE_ROOT}/Modules//CMakeParseImplicitLinkInfo.cmake)
+
+if( NOT ( ("${CMAKE_GENERATOR}" MATCHES "Make") OR
+ ("${CMAKE_GENERATOR}" MATCHES "Ninja") ) )
+ message(FATAL_ERROR "CUDA language not currently supported by \"${CMAKE_GENERATOR}\" generator")
+endif()
+
+if(NOT CMAKE_CUDA_COMPILER)
+ set(CMAKE_CUDA_COMPILER_INIT NOTFOUND)
+
+ # prefer the environment variable CUDACXX
+ if(NOT $ENV{CUDACXX} STREQUAL "")
+ get_filename_component(CMAKE_CUDA_COMPILER_INIT $ENV{CUDACXX} PROGRAM PROGRAM_ARGS CMAKE_CUDA_FLAGS_ENV_INIT)
+ if(CMAKE_CUDA_FLAGS_ENV_INIT)
+ set(CMAKE_CUDA_COMPILER_ARG1 "${CMAKE_CUDA_FLAGS_ENV_INIT}" CACHE STRING "First argument to CXX compiler")
+ endif()
+ if(NOT EXISTS ${CMAKE_CUDA_COMPILER_INIT})
+ message(FATAL_ERROR "Could not find compiler set in environment variable CUDACXX:\n$ENV{CUDACXX}.\n${CMAKE_CUDA_COMPILER_INIT}")
+ endif()
+ endif()
+
+ # finally list compilers to try
+ if(NOT CMAKE_CUDA_COMPILER_INIT)
+ set(CMAKE_CUDA_COMPILER_LIST nvcc)
+ endif()
+
+ _cmake_find_compiler(CUDA)
+else()
+ _cmake_find_compiler_path(CUDA)
+endif()
+
+mark_as_advanced(CMAKE_CUDA_COMPILER)
+
+#Allow the user to specify a host compiler
+set(CMAKE_CUDA_HOST_COMPILER "" CACHE FILEPATH "Host compiler to be used by nvcc")
+if(NOT $ENV{CUDAHOSTCXX} STREQUAL "")
+ get_filename_component(CMAKE_CUDA_HOST_COMPILER $ENV{CUDAHOSTCXX} PROGRAM)
+ if(NOT EXISTS ${CMAKE_CUDA_HOST_COMPILER})
+ message(FATAL_ERROR "Could not find compiler set in environment variable CUDAHOSTCXX:\n$ENV{CUDAHOSTCXX}.\n${CMAKE_CUDA_HOST_COMPILER}")
+ endif()
+endif()
+
+# Build a small source file to identify the compiler.
+if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
+ set(CMAKE_CUDA_COMPILER_ID_RUN 1)
+
+ # Try to identify the compiler.
+ set(CMAKE_CUDA_COMPILER_ID)
+ set(CMAKE_CUDA_PLATFORM_ID)
+ file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in
+ CMAKE_CUDA_COMPILER_ID_PLATFORM_CONTENT)
+
+ list(APPEND CMAKE_CUDA_COMPILER_ID_MATCH_VENDORS NVIDIA)
+ set(CMAKE_CUDA_COMPILER_ID_MATCH_VENDOR_REGEX_NVIDIA "nvcc: NVIDIA \(R\) Cuda compiler driver")
+
+ set(CMAKE_CXX_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdCUDA/(\\./)?(CompilerIdCUDA.xctest/)?CompilerIdCUDA[ \t\n\\\"]")
+ set(CMAKE_CXX_COMPILER_ID_TOOL_MATCH_INDEX 2)
+
+ set(CMAKE_CUDA_COMPILER_ID_FLAGS_ALWAYS -v --keep --keep-dir tmp)
+ if(CMAKE_CUDA_HOST_COMPILER)
+ list(APPEND CMAKE_CUDA_COMPILER_ID_FLAGS_ALWAYS "-ccbin=${CMAKE_CUDA_HOST_COMPILER}")
+ endif()
+
+ include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
+ CMAKE_DETERMINE_COMPILER_ID(CUDA CUDAFLAGS CMakeCUDACompilerId.cu)
+endif()
+
+include(CMakeFindBinUtils)
+if(MSVC_CUDA_ARCHITECTURE_ID)
+ set(SET_MSVC_CUDA_ARCHITECTURE_ID
+ "set(MSVC_CUDA_ARCHITECTURE_ID ${MSVC_CUDA_ARCHITECTURE_ID})")
+endif()
+
+#if this compiler vendor is matches NVIDIA we can determine
+#what the host compiler is. This only needs to be done if the CMAKE_CUDA_HOST_COMPILER
+#has NOT been explicitly set
+#
+#Find the line from compiler ID that contains a.out ( or last line )
+#We also need to find the implicit link lines. Which can be done by replacing
+#the compiler with cuda-fake-ld and pass too CMAKE_PARSE_IMPLICIT_LINK_INFO
+if(CMAKE_CUDA_COMPILER_ID STREQUAL NVIDIA)
+ set(_nvcc_log "")
+ string(REPLACE "\r" "" _nvcc_output_orig "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
+ if(_nvcc_output_orig MATCHES "#\\\$ +LIBRARIES= *([^\n]*)\n")
+ set(_nvcc_libraries "${CMAKE_MATCH_1}")
+ string(APPEND _nvcc_log " found 'LIBRARIES=' string: [${_nvcc_libraries}]\n")
+ else()
+ set(_nvcc_libraries "")
+ string(REPLACE "\n" "\n " _nvcc_output_log "\n${_nvcc_output_orig}")
+ string(APPEND _nvcc_log " no 'LIBRARIES=' string found in nvcc output:${_nvcc_output_log}\n")
+ endif()
+
+ set(_nvcc_link_line "")
+ if(_nvcc_libraries)
+ # Remove variable assignments.
+ string(REGEX REPLACE "#\\\$ *[^= ]+=[^\n]*\n" "" _nvcc_output "${_nvcc_output_orig}")
+ # Split lines.
+ string(REGEX REPLACE "\n+(#\\\$ )?" ";" _nvcc_output "${_nvcc_output}")
+ foreach(line IN LISTS _nvcc_output)
+ set(_nvcc_output_line "${line}")
+ string(APPEND _nvcc_log " considering line: [${_nvcc_output_line}]\n")
+ if("${_nvcc_output_line}" MATCHES "^ *nvlink")
+ string(APPEND _nvcc_log " ignoring nvlink line\n")
+ elseif(_nvcc_libraries)
+ if("${_nvcc_output_line}" MATCHES "(@\"?tmp/a\\.exe\\.res\"?)")
+ set(_nvcc_link_res_arg "${CMAKE_MATCH_1}")
+ set(_nvcc_link_res "${CMAKE_PLATFORM_INFO_DIR}/CompilerIdCUDA/tmp/a.exe.res")
+ if(EXISTS "${_nvcc_link_res}")
+ file(READ "${_nvcc_link_res}" _nvcc_link_res_content)
+ string(REPLACE "${_nvcc_link_res_arg}" "${_nvcc_link_res_content}" _nvcc_output_line "${_nvcc_output_line}")
+ endif()
+ endif()
+ string(FIND "${_nvcc_output_line}" "${_nvcc_libraries}" _nvcc_libraries_pos)
+ if(NOT _nvcc_libraries_pos EQUAL -1)
+ set(_nvcc_link_line "${_nvcc_output_line}")
+ string(APPEND _nvcc_log " extracted link line: [${_nvcc_link_line}]\n")
+ endif()
+ endif()
+ endforeach()
+ endif()
+
+ if(_nvcc_link_line)
+ if("x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC")
+ set(CMAKE_CUDA_HOST_LINK_LAUNCHER "${CMAKE_LINKER}")
+ else()
+ #extract the compiler that is being used for linking
+ separate_arguments(_nvcc_link_line_args UNIX_COMMAND "${_nvcc_link_line}")
+ list(GET _nvcc_link_line_args 0 CMAKE_CUDA_HOST_LINK_LAUNCHER)
+ endif()
+
+ #prefix the line with cuda-fake-ld so that implicit link info believes it is
+ #a link line
+ set(_nvcc_link_line "cuda-fake-ld ${_nvcc_link_line}")
+ CMAKE_PARSE_IMPLICIT_LINK_INFO("${_nvcc_link_line}"
+ CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES
+ CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES
+ CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
+ log
+ "${CMAKE_CUDA_IMPLICIT_OBJECT_REGEX}")
+
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Parsed CUDA nvcc implicit link information from above output:\n${_nvcc_log}\n${log}\n\n")
+ else()
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Failed to parsed CUDA nvcc implicit link information:\n${_nvcc_log}\n\n")
+ message(FATAL_ERROR "Failed to extract nvcc implicit link line.")
+ endif()
+
+ set(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES )
+ if(_nvcc_output_orig MATCHES "#\\\$ +INCLUDES= *([^\n]*)\n")
+ set(_nvcc_includes "${CMAKE_MATCH_1}")
+ string(APPEND _nvcc_log " found 'INCLUDES=' string: [${_nvcc_includes}]\n")
+ else()
+ set(_nvcc_includes "")
+ string(REPLACE "\n" "\n " _nvcc_output_log "\n${_nvcc_output_orig}")
+ string(APPEND _nvcc_log " no 'INCLUDES=' string found in nvcc output:${_nvcc_output_log}\n")
+ endif()
+ if(_nvcc_includes)
+ # across all operating system each include directory is prefixed with -I
+ separate_arguments(_nvcc_output UNIX_COMMAND "${_nvcc_includes}")
+ foreach(line IN LISTS _nvcc_output)
+ string(REGEX REPLACE "^-I" "" line "${line}")
+ get_filename_component(line "${line}" ABSOLUTE)
+ list(APPEND CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES "${line}")
+ endforeach()
+
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Parsed CUDA nvcc include information from above output:\n${_nvcc_log}\n${log}\n\n")
+ else()
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Failed to detect CUDA nvcc include information:\n${_nvcc_log}\n\n")
+ endif()
+
+
+endif()
+
+# configure all variables set in this file
+configure_file(${CMAKE_ROOT}/Modules/CMakeCUDACompiler.cmake.in
+ ${CMAKE_PLATFORM_INFO_DIR}/CMakeCUDACompiler.cmake
+ @ONLY
+ )
+
+set(CMAKE_CUDA_COMPILER_ENV_VAR "CUDACXX")
+set(CMAKE_CUDA_HOST_COMPILER_ENV_VAR "CUDAHOSTCXX")
diff --git a/Modules/CMakeDetermineCompileFeatures.cmake b/Modules/CMakeDetermineCompileFeatures.cmake
index 5ca72cc..3ed92be 100644
--- a/Modules/CMakeDetermineCompileFeatures.cmake
+++ b/Modules/CMakeDetermineCompileFeatures.cmake
@@ -48,6 +48,7 @@ function(cmake_determine_compile_features lang)
set(CMAKE_CXX98_COMPILE_FEATURES)
set(CMAKE_CXX11_COMPILE_FEATURES)
set(CMAKE_CXX14_COMPILE_FEATURES)
+ set(CMAKE_CXX17_COMPILE_FEATURES)
include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake")
@@ -58,6 +59,9 @@ function(cmake_determine_compile_features lang)
return()
endif()
+ if (CMAKE_CXX14_COMPILE_FEATURES AND CMAKE_CXX17_COMPILE_FEATURES)
+ list(REMOVE_ITEM CMAKE_CXX17_COMPILE_FEATURES ${CMAKE_CXX14_COMPILE_FEATURES})
+ endif()
if (CMAKE_CXX11_COMPILE_FEATURES AND CMAKE_CXX14_COMPILE_FEATURES)
list(REMOVE_ITEM CMAKE_CXX14_COMPILE_FEATURES ${CMAKE_CXX11_COMPILE_FEATURES})
endif()
@@ -70,6 +74,7 @@ function(cmake_determine_compile_features lang)
${CMAKE_CXX98_COMPILE_FEATURES}
${CMAKE_CXX11_COMPILE_FEATURES}
${CMAKE_CXX14_COMPILE_FEATURES}
+ ${CMAKE_CXX17_COMPILE_FEATURES}
)
endif()
@@ -77,6 +82,7 @@ function(cmake_determine_compile_features lang)
set(CMAKE_CXX98_COMPILE_FEATURES ${CMAKE_CXX98_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_CXX11_COMPILE_FEATURES ${CMAKE_CXX11_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_CXX14_COMPILE_FEATURES ${CMAKE_CXX14_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_CXX17_COMPILE_FEATURES ${CMAKE_CXX17_COMPILE_FEATURES} PARENT_SCOPE)
message(STATUS "Detecting ${lang} compile features - done")
endif()
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 145efc6..bb34de5 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -101,6 +101,8 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE)
set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE)
set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT}" PARENT_SCOPE)
+ set(CMAKE_${lang}_COMPILER_PRODUCED_OUTPUT "${COMPILER_${lang}_PRODUCED_OUTPUT}" PARENT_SCOPE)
+ set(CMAKE_${lang}_COMPILER_PRODUCED_FILES "${COMPILER_${lang}_PRODUCED_FILES}" PARENT_SCOPE)
endfunction()
include(CMakeCompilerIdDetection)
@@ -129,13 +131,14 @@ function(CMAKE_DETERMINE_COMPILER_ID_BUILD lang testflags src)
# Create a clean working directory.
file(REMOVE_RECURSE ${CMAKE_${lang}_COMPILER_ID_DIR})
file(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR})
+ file(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}/tmp)
CMAKE_DETERMINE_COMPILER_ID_WRITE("${lang}" "${src}")
# Construct a description of this test case.
set(COMPILER_DESCRIPTION
"Compiler: ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_COMPILER_ID_ARG1}
Build flags: ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
-Id flags: ${testflags}
+Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
")
# Compile the compiler identification source.
@@ -162,6 +165,10 @@ Id flags: ${testflags}
set(v Intel)
set(ext vfproj)
set(id_cl ifort.exe)
+ elseif(lang STREQUAL CSharp)
+ set(v 10)
+ set(ext csproj)
+ set(id_cl csc.exe)
elseif(NOT "${vs_version}" VERSION_LESS 10)
set(v 10)
set(ext vcxproj)
@@ -182,6 +189,11 @@ Id flags: ${testflags}
else()
set(id_toolset "")
endif()
+ if(CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE)
+ set(id_PreferredToolArchitecture "<PreferredToolArchitecture>${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE}</PreferredToolArchitecture>")
+ else()
+ set(id_PreferredToolArchitecture "")
+ endif()
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone")
set(id_system "<ApplicationType>Windows Phone</ApplicationType>")
elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
@@ -317,6 +329,7 @@ Id flags: ${testflags}
${CMAKE_${lang}_COMPILER_ID_ARG1}
${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
${testflags}
+ ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
"${src}"
WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
@@ -395,6 +408,7 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT}
# Return the files produced by the compilation.
set(COMPILER_${lang}_PRODUCED_FILES "${COMPILER_${lang}_PRODUCED_FILES}" PARENT_SCOPE)
set(COMPILER_${lang}_PRODUCED_OUTPUT "${COMPILER_${lang}_PRODUCED_OUTPUT}" PARENT_SCOPE)
+
endfunction()
#-----------------------------------------------------------------------------
@@ -438,8 +452,12 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
set(SIMULATE_ID)
set(SIMULATE_VERSION)
file(STRINGS ${file}
- CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 38 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
+ CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 38
+ ${CMAKE_${lang}_COMPILER_ID_STRINGS_PARAMETERS}
+ REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
set(COMPILER_ID_TWICE)
+ # In C# binaries, some strings are found more than once.
+ list(REMOVE_DUPLICATES CMAKE_${lang}_COMPILER_ID_STRINGS)
foreach(info ${CMAKE_${lang}_COMPILER_ID_STRINGS})
if("${info}" MATCHES "INFO:compiler\\[([^]\"]*)\\]")
if(COMPILER_ID)
diff --git a/Modules/CMakeExpandImportedTargets.cmake b/Modules/CMakeExpandImportedTargets.cmake
index add0c6d..ad065f0 100644
--- a/Modules/CMakeExpandImportedTargets.cmake
+++ b/Modules/CMakeExpandImportedTargets.cmake
@@ -37,9 +37,6 @@
# LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
# CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}" )
-
-include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
-
function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT )
set(options )
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index 75a031e..4c0486e 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -25,6 +25,7 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
OR "x${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "xMSVC"
OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC"
OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC"
+ OR "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC"
OR (CMAKE_GENERATOR MATCHES "Visual Studio"
AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android"))
diff --git a/Modules/CMakeGraphVizOptions.cmake b/Modules/CMakeGraphVizOptions.cmake
index e7c4de6..420e3a9 100644
--- a/Modules/CMakeGraphVizOptions.cmake
+++ b/Modules/CMakeGraphVizOptions.cmake
@@ -13,8 +13,8 @@
# CMake
# can generate graphviz files, showing the dependencies between the
# targets in a project and also external libraries which are linked
-# against. When CMake is run with the --graphviz=foo option, it will
-# produce
+# against. When CMake is run with the --graphviz=foo.dot option, it will
+# produce:
#
# * a foo.dot file showing all dependencies in the project
# * a foo.dot.<target> file for each target, file showing on which other targets the respective target depends
@@ -29,11 +29,18 @@
#
# .. variable:: GRAPHVIZ_GRAPH_TYPE
#
-# The graph type
+# The graph type.
#
# * Mandatory : NO
# * Default : "digraph"
#
+# Valid graph types are:
+#
+# * "graph" : Nodes are joined with lines
+# * "digraph" : Nodes are joined with arrows showing direction
+# * "strict graph" : Like "graph" but max one line between each node
+# * "strict digraph" : Like "graph" but max one line between each node in each direction
+#
# .. variable:: GRAPHVIZ_GRAPH_NAME
#
# The graph name.
diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
index 8415641..90c2a57 100644
--- a/Modules/CMakePackageConfigHelpers.cmake
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -40,7 +40,7 @@
# set(FOO_INCLUDE_DIR "@CMAKE_INSTALL_FULL_INCLUDEDIR@" )
# set(FOO_DATA_DIR "@CMAKE_INSTALL_PREFIX@/@RELATIVE_DATA_INSTALL_DIR@" )
# set(FOO_ICONS_DIR "@CMAKE_INSTALL_PREFIX@/share/icons" )
-# ...logic to determine installedPrefix from the own location...
+# #...logic to determine installedPrefix from the own location...
# set(FOO_CONFIG_DIR "${installedPrefix}/@CONFIG_INSTALL_DIR@" )
#
# All 4 options shown above are not sufficient, since the first 3 hardcode the
@@ -174,7 +174,7 @@
# set(INCLUDE_INSTALL_DIR include/ ... CACHE )
# set(LIB_INSTALL_DIR lib/ ... CACHE )
# set(SYSCONFIG_INSTALL_DIR etc/foo/ ... CACHE )
-# ...
+# #...
# include(CMakePackageConfigHelpers)
# configure_package_config_file(FooConfig.cmake.in
# ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake
@@ -190,7 +190,7 @@
#
# ``FooConfig.cmake.in``:
#
-# .. code-block:: cmake
+# ::
#
# set(FOO_VERSION x.y.z)
# ...
@@ -201,9 +201,6 @@
#
# check_required_components(Foo)
-
-include(CMakeParseArguments)
-
include(WriteBasicConfigVersionFile)
macro(WRITE_BASIC_PACKAGE_VERSION_FILE)
diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake
index 2031ba5..3469d34 100644
--- a/Modules/CMakeParseImplicitLinkInfo.cmake
+++ b/Modules/CMakeParseImplicitLinkInfo.cmake
@@ -45,6 +45,7 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
endif()
list(GET args 0 cmd)
endif()
+ set(is_msvc 0)
if("${cmd}" MATCHES "${linker_regex}")
string(APPEND log " link line: [${line}]\n")
string(REGEX REPLACE ";-([LYz]);" ";-\\1" args "${args}")
@@ -54,6 +55,17 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
string(REGEX REPLACE "^-L" "" dir "${arg}")
list(APPEND implicit_dirs_tmp ${dir})
string(APPEND log " arg [${arg}] ==> dir [${dir}]\n")
+ elseif("${arg}" MATCHES "^[-/]LIBPATH:(.+)")
+ # MSVC search path.
+ set(dir "${CMAKE_MATCH_1}")
+ list(APPEND implicit_dirs_tmp ${dir})
+ string(APPEND log " arg [${arg}] ==> dir [${dir}]\n")
+ elseif(is_msvc AND "${arg}" STREQUAL "-link")
+ string(APPEND log " arg [${arg}] ==> ignore MSVC cl option\n")
+ elseif(is_msvc AND "${arg}" MATCHES "^(.*\\.[Ll][Ii][Bb])$")
+ set(lib "${CMAKE_MATCH_1}")
+ list(APPEND implicit_libs_tmp ${lib})
+ string(APPEND log " arg [${arg}] ==> lib [${lib}]\n")
elseif("${arg}" MATCHES "^-l([^:].*)$")
# Unix library.
set(lib "${CMAKE_MATCH_1}")
@@ -82,6 +94,9 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
# Link editor option.
list(APPEND implicit_libs_tmp ${arg})
string(APPEND log " arg [${arg}] ==> opt [${arg}]\n")
+ elseif("${arg}" STREQUAL "cl.exe")
+ string(APPEND log " arg [${arg}] ==> recognize MSVC cl\n")
+ set(is_msvc 1)
else()
string(APPEND log " arg [${arg}] ==> ignore\n")
endif()
diff --git a/Modules/CMakePrintHelpers.cmake b/Modules/CMakePrintHelpers.cmake
index bf98a42..21c333e 100644
--- a/Modules/CMakePrintHelpers.cmake
+++ b/Modules/CMakePrintHelpers.cmake
@@ -39,8 +39,6 @@
#
# -- CMAKE_C_COMPILER="/usr/bin/gcc" ; CMAKE_MAJOR_VERSION="2" ; DOES_NOT_EXIST=""
-include(CMakeParseArguments)
-
function(CMAKE_PRINT_VARIABLES)
set(msg "")
foreach(var ${ARGN})
diff --git a/Modules/CMakeTestCSharpCompiler.cmake b/Modules/CMakeTestCSharpCompiler.cmake
new file mode 100644
index 0000000..1a8bf32
--- /dev/null
+++ b/Modules/CMakeTestCSharpCompiler.cmake
@@ -0,0 +1,64 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+if(CMAKE_CSharp_COMPILER_FORCED)
+ # The compiler configuration was forced by the user.
+ # Assume the user has configured all compiler information.
+ set(CMAKE_CSharp_COMPILER_WORKS TRUE)
+ return()
+endif()
+
+include(CMakeTestCompilerCommon)
+
+unset(CMAKE_CSharp_COMPILER_WORKS CACHE)
+
+set(test_compile_file "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCSharpCompiler.cs")
+
+# This file is used by EnableLanguage in cmGlobalGenerator to
+# determine that that selected C# compiler can actually compile
+# and link the most basic of programs. If not, a fatal error
+# is set and cmake stops processing commands and will not generate
+# any makefiles or projects.
+if(NOT CMAKE_CSharp_COMPILER_WORKS)
+ PrintTestCompilerStatus("C#" "${CMAKE_CSharp_COMPILER}")
+ file(WRITE "${test_compile_file}"
+ "namespace Test {"
+ " public class CSharp {"
+ " static void Main(string[] args) {}"
+ " }"
+ "}"
+ )
+ try_compile(CMAKE_CSharp_COMPILER_WORKS ${CMAKE_BINARY_DIR} "${test_compile_file}"
+ OUTPUT_VARIABLE __CMAKE_CSharp_COMPILER_OUTPUT
+ )
+ # Move result from cache to normal variable.
+ set(CMAKE_CSharp_COMPILER_WORKS ${CMAKE_CSharp_COMPILER_WORKS})
+ unset(CMAKE_CSharp_COMPILER_WORKS CACHE)
+ set(CSharp_TEST_WAS_RUN 1)
+endif()
+
+if(NOT CMAKE_CSharp_COMPILER_WORKS)
+ PrintTestCompilerStatus("C#" "${CMAKE_CSharp_COMPILER} -- broken")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if the C# compiler works failed with "
+ "the following output:\n${__CMAKE_CSharp_COMPILER_OUTPUT}\n\n")
+ message(FATAL_ERROR "The C# compiler \"${CMAKE_CSharp_COMPILER}\" "
+ "is not able to compile a simple test program.\nIt fails "
+ "with the following output:\n ${__CMAKE_CSharp_COMPILER_OUTPUT}\n\n"
+ "CMake will not be able to correctly generate this project.")
+else()
+ if(CSharp_TEST_WAS_RUN)
+ PrintTestCompilerStatus("C#" "${CMAKE_CSharp_COMPILER} -- works")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if the C# compiler works passed with "
+ "the following output:\n${__CMAKE_CSharp_COMPILER_OUTPUT}\n\n")
+ endif()
+
+ # Re-configure to save learned information.
+ configure_file(
+ ${CMAKE_ROOT}/Modules/CMakeCSharpCompiler.cmake.in
+ ${CMAKE_PLATFORM_INFO_DIR}/CMakeCSharpCompiler.cmake
+ @ONLY
+ )
+ include(${CMAKE_PLATFORM_INFO_DIR}/CMakeCSharpCompiler.cmake)
+endif()
diff --git a/Modules/CMakeTestCUDACompiler.cmake b/Modules/CMakeTestCUDACompiler.cmake
new file mode 100644
index 0000000..80113cb
--- /dev/null
+++ b/Modules/CMakeTestCUDACompiler.cmake
@@ -0,0 +1,76 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+if(CMAKE_CUDA_COMPILER_FORCED)
+ # The compiler configuration was forced by the user.
+ # Assume the user has configured all compiler information.
+ set(CMAKE_CUDA_COMPILER_WORKS TRUE)
+ return()
+endif()
+
+include(CMakeTestCompilerCommon)
+
+# Remove any cached result from an older CMake version.
+# We now store this in CMakeCUDACompiler.cmake.
+unset(CMAKE_CUDA_COMPILER_WORKS CACHE)
+
+# This file is used by EnableLanguage in cmGlobalGenerator to
+# determine that that selected cuda compiler can actually compile
+# and link the most basic of programs. If not, a fatal error
+# is set and cmake stops processing commands and will not generate
+# any makefiles or projects.
+if(NOT CMAKE_CUDA_COMPILER_WORKS)
+ PrintTestCompilerStatus("CUDA" "")
+ file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/main.cu
+ "#ifndef __CUDACC__\n"
+ "# error \"The CMAKE_CUDA_COMPILER is set to an invalid CUDA compiler\"\n"
+ "#endif\n"
+ "int main(){return 0;}\n")
+
+ try_compile(CMAKE_CUDA_COMPILER_WORKS ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/main.cu
+ OUTPUT_VARIABLE __CMAKE_CUDA_COMPILER_OUTPUT)
+
+ # Move result from cache to normal variable.
+ set(CMAKE_CUDA_COMPILER_WORKS ${CMAKE_CUDA_COMPILER_WORKS})
+ unset(CMAKE_CUDA_COMPILER_WORKS CACHE)
+ set(CUDA_TEST_WAS_RUN 1)
+endif()
+
+if(NOT CMAKE_CUDA_COMPILER_WORKS)
+ PrintTestCompilerStatus("CUDA" " -- broken")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if the CUDA compiler works failed with "
+ "the following output:\n${__CMAKE_CUDA_COMPILER_OUTPUT}\n\n")
+ message(FATAL_ERROR "The CUDA compiler \"${CMAKE_CUDA_COMPILER}\" "
+ "is not able to compile a simple test program.\nIt fails "
+ "with the following output:\n ${__CMAKE_CUDA_COMPILER_OUTPUT}\n\n"
+ "CMake will not be able to correctly generate this project.")
+else()
+ if(CUDA_TEST_WAS_RUN)
+ PrintTestCompilerStatus("CUDA" " -- works")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if the CUDA compiler works passed with "
+ "the following output:\n${__CMAKE_CUDA_COMPILER_OUTPUT}\n\n")
+ endif()
+
+ # Try to identify the ABI and configure it into CMakeCUDACompiler.cmake
+ include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake)
+ CMAKE_DETERMINE_COMPILER_ABI(CUDA ${CMAKE_ROOT}/Modules/CMakeCUDACompilerABI.cu)
+
+ if("x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC")
+ set(CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES "${CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES}")
+ set(CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES "${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES}")
+ endif()
+
+ # Re-configure to save learned information.
+ configure_file(
+ ${CMAKE_ROOT}/Modules/CMakeCUDACompiler.cmake.in
+ ${CMAKE_PLATFORM_INFO_DIR}/CMakeCUDACompiler.cmake
+ @ONLY
+ )
+ include(${CMAKE_PLATFORM_INFO_DIR}/CMakeCUDACompiler.cmake)
+endif()
+
+
+unset(__CMAKE_CUDA_COMPILER_OUTPUT)
diff --git a/Modules/CPack.STGZ_Header.sh.in b/Modules/CPack.STGZ_Header.sh.in
index dee576f..c615851 100755
--- a/Modules/CPack.STGZ_Header.sh.in
+++ b/Modules/CPack.STGZ_Header.sh.in
@@ -130,7 +130,10 @@ echo ""
use_new_tail_syntax="-n"
tail $use_new_tail_syntax +1 "$0" > /dev/null 2> /dev/null || use_new_tail_syntax=""
-tail $use_new_tail_syntax +###CPACK_HEADER_LENGTH### "$0" | gunzip | (cd "${toplevel}" && tar xf -) || cpack_echo_exit "Problem unpacking the @CPACK_PACKAGE_FILE_NAME@"
+extractor="pax -r"
+command -v pax > /dev/null 2> /dev/null || extractor="tar xf -"
+
+tail $use_new_tail_syntax +###CPACK_HEADER_LENGTH### "$0" | gunzip | (cd "${toplevel}" && ${extractor}) || cpack_echo_exit "Problem unpacking the @CPACK_PACKAGE_FILE_NAME@"
echo "Unpacking finished successfully"
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index cee1914..4e7546b 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -126,7 +126,9 @@
#
# ${CPACK_PACKAGE_FILE_NAME}.${CPACK_PACKAGE_CHECKSUM}
#
-# Current supported alogorithms: MD5|SHA1|SHA224|SHA256|SHA384|SHA512.
+# Supported algorithms are those listed by the
+# :ref:`string(\<HASH\>) <Supported Hash Algorithms>`
+# command.
#
# .. variable:: CPACK_PROJECT_CONFIG_FILE
#
diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake
index 909a12b..ddf8b23 100644
--- a/Modules/CPackDeb.cmake
+++ b/Modules/CPackDeb.cmake
@@ -587,12 +587,21 @@ function(cpack_deb_prepare_package_vars)
file(GLOB_RECURSE FILE_PATHS_ LIST_DIRECTORIES false RELATIVE "${WDIR}" "${WDIR}/*")
cmake_policy(POP)
+ find_program(FILE_EXECUTABLE file)
+ if(NOT FILE_EXECUTABLE)
+ message(FATAL_ERROR "CPackDeb: file utility is not available. CPACK_DEBIAN_PACKAGE_SHLIBDEPS and CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS options are not available.")
+ endif()
+
# get file info so that we can determine if file is executable or not
unset(CPACK_DEB_INSTALL_FILES)
foreach(FILE_ IN LISTS FILE_PATHS_)
- execute_process(COMMAND file "./${FILE_}"
+ execute_process(COMMAND env LC_ALL=C ${FILE_EXECUTABLE} "./${FILE_}"
WORKING_DIRECTORY "${WDIR}"
+ RESULT_VARIABLE FILE_RESULT_
OUTPUT_VARIABLE INSTALL_FILE_)
+ if(NOT FILE_RESULT_ EQUAL 0)
+ message (FATAL_ERROR "CPackDeb: execution of command: '${FILE_EXECUTABLE} ./${FILE_}' failed with exit code: ${FILE_RESULT_}")
+ endif()
list(APPEND CPACK_DEB_INSTALL_FILES "${INSTALL_FILE_}")
endforeach()
@@ -905,7 +914,7 @@ function(cpack_deb_prepare_package_vars)
extract_so_info("${_FILE}" libname soversion)
if(libname AND soversion)
list(APPEND CPACK_DEBIAN_PACKAGE_SHLIBS_LIST
- "${libname} ${soversion} ${CPACK_DEBIAN_PACKAGE_NAME} (${CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY} ${CPACK_PACKAGE_VERSION})")
+ "${libname} ${soversion} ${CPACK_DEBIAN_PACKAGE_NAME} (${CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY} ${CPACK_DEBIAN_PACKAGE_VERSION})")
else()
message(AUTHOR_WARNING "Shared library '${_FILE}' is missing soname or soversion. Library will not be added to DEBIAN/shlibs control file.")
endif()
@@ -958,7 +967,7 @@ function(cpack_deb_prepare_package_vars)
# Patch package file name to be in corrent debian format:
# <foo>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb
set(CPACK_OUTPUT_FILE_NAME
- "${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb")
+ "${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_DEBIAN_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb")
else()
cmake_policy(PUSH)
cmake_policy(SET CMP0010 NEW)
diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake
index 08078cb..deb724c 100644
--- a/Modules/CPackIFW.cmake
+++ b/Modules/CPackIFW.cmake
@@ -76,6 +76,34 @@
#
# Filename for a logo is used as QWizard::LogoPixmap.
#
+# .. variable:: CPACK_IFW_PACKAGE_WATERMARK
+#
+# Filename for a watermark is used as QWizard::WatermarkPixmap.
+#
+# .. variable:: CPACK_IFW_PACKAGE_BANNER
+#
+# Filename for a banner is used as QWizard::BannerPixmap.
+#
+# .. variable:: CPACK_IFW_PACKAGE_BACKGROUND
+#
+# Filename for an image used as QWizard::BackgroundPixmap (only used by MacStyle).
+#
+# .. variable:: CPACK_IFW_PACKAGE_WIZARD_STYLE
+#
+# Wizard style to be used ("Modern", "Mac", "Aero" or "Classic").
+#
+# .. variable:: CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH
+#
+# Default width of the wizard in pixels. Setting a banner image will override this.
+#
+# .. variable:: CPACK_IFW_PACKAGE_WIZARD_DEFAULT_HEIGHT
+#
+# Default height of the wizard in pixels. Setting a watermark image will override this.
+#
+# .. variable:: CPACK_IFW_PACKAGE_TITLE_COLOR
+#
+# Color of the titles and subtitles (takes an HTML color code, such as "#88FF33").
+#
# .. variable:: CPACK_IFW_PACKAGE_START_MENU_DIRECTORY
#
# Name of the default program group for the product in the Windows Start menu.
@@ -198,14 +226,22 @@
#
# ::
#
-# cpack_ifw_configure_component(<compname> [COMMON] [ESSENTIAL]
+# cpack_ifw_configure_component(<compname> [COMMON] [ESSENTIAL] [VIRTUAL]
+# [FORCED_INSTALLATION] [REQUIRES_ADMIN_RIGHTS]
# [NAME <name>]
+# [DISPLAY_NAME <display_name>]
+# [DESCRIPTION <description>]
+# [UPDATE_TEXT <update_text>]
# [VERSION <version>]
+# [RELEASE_DATE <release_date>]
# [SCRIPT <script>]
-# [PRIORITY <priority>]
-# [DEPENDS <com_id> ...]
+# [PRIORITY|SORTING_PRIORITY <sorting_priority>] # Note: PRIORITY is deprecated
+# [DEPENDS|DEPENDENCIES <com_id> ...]
+# [AUTO_DEPEND_ON <comp_id> ...]
# [LICENSES <display_name> <file_path> ...]
-# [USER_INTERFACES <file_path> <file_path> ...])
+# [DEFAULT <value>]
+# [USER_INTERFACES <file_path> <file_path> ...]
+# [TRANSLATIONS <file_path> <file_path> ...])
#
# This command should be called after :command:`cpack_add_component` command.
#
@@ -217,30 +253,74 @@
# if set, then the package manager stays disabled until that
# component is updated.
#
+# ``VIRTUAL``
+# if set, then the component will be hidden from the installer.
+# It is a equivalent of the ``HIDDEN`` option from the
+# :command:`cpack_add_component` command.
+#
+# ``FORCED_INSTALLATION``
+# if set, then the component must always be installed.
+# It is a equivalent of the ``REQUARED`` option from the
+# :command:`cpack_add_component` command.
+#
+# ``REQUIRES_ADMIN_RIGHTS``
+# set it if the component needs to be installed with elevated permissions.
+#
# ``NAME``
# is used to create domain-like identification for this component.
# By default used origin component name.
#
+# ``DISPLAY_NAME``
+# set to rewrite original name configured by
+# :command:`cpack_add_component` command.
+#
+# ``DESCRIPTION``
+# set to rewrite original description configured by
+# :command:`cpack_add_component` command.
+#
+# ``UPDATE_TEXT``
+# will be added to the component description if this is an update to
+# the component.
+#
# ``VERSION``
# is version of component.
# By default used :variable:`CPACK_PACKAGE_VERSION`.
#
+# ``RELEASE_DATE``
+# keep empty to auto generate.
+#
# ``SCRIPT``
# is a relative or absolute path to operations script
# for this component.
#
-# ``PRIORITY``
+# ``PRIORITY`` | ``SORTING_PRIORITY``
# is priority of the component in the tree.
+# The ``PRIORITY`` option is deprecated and will be removed in a future
+# version of CMake. Please use ``SORTING_PRIORITY`` option instead.
+#
+# ``DEPENDS`` | ``DEPENDENCIES``
+# list of dependency component or component group identifiers in
+# QtIFW_ style.
#
-# ``DEPENDS``
-# list of dependency component identifiers in QtIFW_ style.
+# ``AUTO_DEPEND_ON``
+# list of identifiers of component or component group in QtIFW_ style
+# that this component has an automatic dependency on.
#
# ``LICENSES``
# pair of <display_name> and <file_path> of license text for this
# component. You can specify more then one license.
#
+# ``DEFAULT``
+# Possible values are: TRUE, FALSE, and SCRIPT.
+# Set to FALSE to disable the component in the installer or to SCRIPT
+# to resolved during runtime (don't forget add the file of the script
+# as a value of the ``SCRIPT`` option).
+#
# ``USER_INTERFACES``
-# a list of <file_path> representing pages to load
+# is a list of <file_path> ('.ui' files) representing pages to load.
+#
+# ``TRANSLATIONS``
+# is a list of <file_path> ('.qm' files) representing translations to load.
#
#
# .. command:: cpack_ifw_configure_component_group
@@ -249,38 +329,93 @@
#
# ::
#
-# cpack_ifw_configure_component_group(<groupname>
+# cpack_ifw_configure_component_group(<groupname> [VIRTUAL]
+# [FORCED_INSTALLATION] [REQUIRES_ADMIN_RIGHTS]
# [NAME <name>]
+# [DISPLAY_NAME <display_name>]
+# [DESCRIPTION <description>]
+# [UPDATE_TEXT <update_text>]
# [VERSION <version>]
+# [RELEASE_DATE <release_date>]
# [SCRIPT <script>]
-# [PRIORITY <priority>]
+# [PRIORITY|SORTING_PRIORITY <sorting_priority>] # Note: PRIORITY is deprecated
+# [DEPENDS|DEPENDENCIES <com_id> ...]
+# [AUTO_DEPEND_ON <comp_id> ...]
# [LICENSES <display_name> <file_path> ...]
-# [USER_INTERFACES <file_path> <file_path> ...])
+# [DEFAULT <value>]
+# [USER_INTERFACES <file_path> <file_path> ...]
+# [TRANSLATIONS <file_path> <file_path> ...])
#
# This command should be called after :command:`cpack_add_component_group`
# command.
#
+# ``VIRTUAL``
+# if set, then the group will be hidden from the installer.
+# Note that setting this on a root component does not work.
+#
+# ``FORCED_INSTALLATION``
+# if set, then the group must always be installed.
+#
+# ``REQUIRES_ADMIN_RIGHTS``
+# set it if the component group needs to be installed with elevated
+# permissions.
+#
# ``NAME``
# is used to create domain-like identification for this component group.
# By default used origin component group name.
#
+# ``DISPLAY_NAME``
+# set to rewrite original name configured by
+# :command:`cpack_add_component_group` command.
+#
+# ``DESCRIPTION``
+# set to rewrite original description configured by
+# :command:`cpack_add_component_group` command.
+#
+# ``UPDATE_TEXT``
+# will be added to the component group description if this is an update to
+# the component group.
+#
# ``VERSION``
# is version of component group.
# By default used :variable:`CPACK_PACKAGE_VERSION`.
#
+# ``RELEASE_DATE``
+# keep empty to auto generate.
+#
# ``SCRIPT``
# is a relative or absolute path to operations script
# for this component group.
#
-# ``PRIORITY``
+# ``PRIORITY`` | ``SORTING_PRIORITY``
# is priority of the component group in the tree.
+# The ``PRIORITY`` option is deprecated and will be removed in a future
+# version of CMake. Please use ``SORTING_PRIORITY`` option instead.
+#
+# ``DEPENDS`` | ``DEPENDENCIES``
+# list of dependency component or component group identifiers in
+# QtIFW_ style.
+#
+# ``AUTO_DEPEND_ON``
+# list of identifiers of component or component group in QtIFW_ style
+# that this component group has an automatic dependency on.
#
# ``LICENSES``
# pair of <display_name> and <file_path> of license text for this
# component group. You can specify more then one license.
#
+# ``DEFAULT``
+# Possible values are: TRUE, FALSE, and SCRIPT.
+# Set to TRUE to preselect the group in the installer
+# (this takes effect only on groups that have no visible child components)
+# or to SCRIPT to resolved during runtime (don't forget add the file of
+# the script as a value of the ``SCRIPT`` option).
+#
# ``USER_INTERFACES``
-# a list of <file_path> representing pages to load
+# is a list of <file_path> ('.ui' files) representing pages to load.
+#
+# ``TRANSLATIONS``
+# is a list of <file_path> ('.qm' files) representing translations to load.
#
#
# .. command:: cpack_ifw_add_repository
@@ -568,10 +703,6 @@ if(NOT CPackComponent_CMake_INCLUDED)
include(CPackComponent)
endif()
-if(NOT __CMAKE_PARSE_ARGUMENTS_INCLUDED)
- include(CMakeParseArguments)
-endif()
-
# Resolve full filename for script file
macro(_cpack_ifw_resolve_script _variable)
set(_ifw_script_macro ${_variable})
@@ -625,14 +756,15 @@ macro(cpack_ifw_configure_component compname)
string(TOUPPER ${compname} _CPACK_IFWCOMP_UNAME)
- set(_IFW_OPT COMMON ESSENTIAL)
- set(_IFW_ARGS NAME VERSION SCRIPT PRIORITY)
- set(_IFW_MULTI_ARGS DEPENDS LICENSES USER_INTERFACES)
+ set(_IFW_OPT COMMON ESSENTIAL VIRTUAL FORCED_INSTALLATION REQUIRES_ADMIN_RIGHTS)
+ set(_IFW_ARGS NAME DISPLAY_NAME DESCRIPTION VERSION RELEASE_DATE SCRIPT PRIORITY SORTING_PRIORITY UPDATE_TEXT DEFAULT)
+ set(_IFW_MULTI_ARGS DEPENDS DEPENDENCIES AUTO_DEPEND_ON LICENSES USER_INTERFACES TRANSLATIONS)
cmake_parse_arguments(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
_cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_SCRIPT)
_cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_LICENSES)
_cpack_ifw_resolve_file_list(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_USER_INTERFACES)
+ _cpack_ifw_resolve_file_list(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_TRANSLATIONS)
set(_CPACK_IFWCOMP_STR "\n# Configuration for IFW component \"${compname}\"\n")
@@ -665,14 +797,15 @@ macro(cpack_ifw_configure_component_group grpname)
string(TOUPPER ${grpname} _CPACK_IFWGRP_UNAME)
- set(_IFW_OPT)
- set(_IFW_ARGS NAME VERSION SCRIPT PRIORITY)
- set(_IFW_MULTI_ARGS LICENSES USER_INTERFACES)
+ set(_IFW_OPT VIRTUAL FORCED_INSTALLATION REQUIRES_ADMIN_RIGHTS)
+ set(_IFW_ARGS NAME DISPLAY_NAME DESCRIPTION VERSION RELEASE_DATE SCRIPT PRIORITY SORTING_PRIORITY UPDATE_TEXT DEFAULT)
+ set(_IFW_MULTI_ARGS DEPENDS DEPENDENCIES AUTO_DEPEND_ON LICENSES USER_INTERFACES TRANSLATIONS)
cmake_parse_arguments(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
_cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_SCRIPT)
_cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_LICENSES)
_cpack_ifw_resolve_file_list(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_USER_INTERFACES)
+ _cpack_ifw_resolve_file_list(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_TRANSLATIONS)
set(_CPACK_IFWGRP_STR "\n# Configuration for IFW component group \"${grpname}\"\n")
diff --git a/Modules/CPackIFWConfigureFile.cmake b/Modules/CPackIFWConfigureFile.cmake
new file mode 100644
index 0000000..790574a
--- /dev/null
+++ b/Modules/CPackIFWConfigureFile.cmake
@@ -0,0 +1,65 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#.rst:
+# CPackIFWConfigureFile
+# ---------------------
+#
+# The module defines :command:`configure_file` similar command to
+# configure file templates prepared in QtIFW/SDK/Creator style.
+#
+#
+# Commands
+# ^^^^^^^^
+#
+# The module defines the following commands:
+#
+# .. command:: cpack_ifw_configure_file
+#
+# Copy a file to another location and modify its contents.
+#
+# ::
+#
+# cpack_ifw_configure_file(<input> <output>)
+#
+# Copies an ``<input>`` file to an ``<output>`` file and substitutes variable
+# values referenced as ``%{VAR}`` or ``%VAR%`` in the input file content.
+# Each variable reference will be replaced with the current value of the
+# variable, or the empty string if the variable is not defined.
+#
+
+# NOTE: This file used to himself packaging via CPack IFW generator and
+# should be compatible with minimal CMake version defined in
+# ../CMakeLists.txt file.
+
+if(NOT DEFINED CPackIFWConfigureFile_CMake_INCLUDED)
+set(CPackIFWConfigureFile_CMake_INCLUDED 1)
+
+macro(cpack_ifw_configure_file INPUT OUTPUT)
+ file(READ "${INPUT}" _tmp)
+ foreach(_tmp_regex "%{([^%}]+)}" "%([^%]+)%")
+ string(REGEX MATCHALL "${_tmp_regex}" _tmp_vars "${_tmp}")
+ while(_tmp_vars)
+ foreach(_tmp_var ${_tmp_vars})
+ string(REGEX REPLACE "${_tmp_regex}" "\\1"
+ _tmp_var_name "${_tmp_var}")
+ if(DEFINED ${_tmp_var_name})
+ set(_tmp_var_value "${${_tmp_var_name}}")
+ elseif(NOT "$ENV{${_tmp_var_name}}" STREQUAL "")
+ set(_tmp_var_value "$ENV{${_tmp_var_name}}")
+ else()
+ set(_tmp_var_value "")
+ endif()
+ string(REPLACE "${_tmp_var}" "${_tmp_var_value}" _tmp "${_tmp}")
+ endforeach()
+ string(REGEX MATCHALL "${_tmp_regex}" _tmp_vars "${_tmp}")
+ endwhile()
+ endforeach()
+ if(IS_ABSOLUTE "${OUTPUT}")
+ file(WRITE "${OUTPUT}" "${_tmp}")
+ else()
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT}" "${_tmp}")
+ endif()
+endmacro()
+
+endif() # NOT DEFINED CPackIFWConfigureFile_CMake_INCLUDED
diff --git a/Modules/CPackProductBuild.cmake b/Modules/CPackProductBuild.cmake
index ea2fa7c..d545d3e 100644
--- a/Modules/CPackProductBuild.cmake
+++ b/Modules/CPackProductBuild.cmake
@@ -20,9 +20,29 @@
# the automatically detected command (or specify its location if the
# auto-detection fails to find it.)
#
+# .. variable:: CPACK_PRODUCTBUILD_IDENTITY_NAME
+#
+# Adds a digital signature to the resulting package.
+#
+#
+# .. variable:: CPACK_PRODUCTBUILD_KEYCHAIN_PATH
+#
+# Specify a specific keychain to search for the signing identity.
+#
+#
# .. variable:: CPACK_COMMAND_PKGBUILD
#
# Path to the pkgbuild(1) command used to generate an OS X component package
# on OS X. This variable can be used to override the automatically detected
# command (or specify its location if the auto-detection fails to find it.)
#
+#
+# .. variable:: CPACK_PKGBUILD_IDENTITY_NAME
+#
+# Adds a digital signature to the resulting package.
+#
+#
+# .. variable:: CPACK_PKGBUILD_KEYCHAIN_PATH
+#
+# Specify a specific keychain to search for the signing identity.
+#
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index 0640630..722ee15 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -95,6 +95,17 @@
# and it is up to the packager to set the variables in a manner that will
# prevent such errors.
#
+# .. variable:: CPACK_RPM_MAIN_COMPONENT
+#
+# Main component that is packaged without component suffix.
+#
+# * Mandatory : NO
+# * Default : -
+#
+# This variable can be set to any component or group name so that component or
+# group rpm package is generated without component suffix in filename and
+# package name.
+#
# .. variable:: CPACK_RPM_PACKAGE_VERSION
#
# The RPM package version.
@@ -496,10 +507,12 @@
#
# May be used to explicitly specify ``%(<directive>)`` file line
# in the spec file. Like ``%config(noreplace)`` or any other directive
-# that be found in the ``%files`` section. Since CPackRPM is generating
-# the list of files (and directories) the user specified files of
-# the ``CPACK_RPM_<COMPONENT>_USER_FILELIST`` list will be removed from
-# the generated list.
+# that be found in the ``%files`` section. You can have multiple directives
+# per line, as in ``%attr(600,root,root) %config(noreplace)``. Since
+# CPackRPM is generating the list of files (and directories) the user
+# specified files of the ``CPACK_RPM_<COMPONENT>_USER_FILELIST`` list will
+# be removed from the generated list. If referring to directories do
+# not add a trailing slash.
#
# .. variable:: CPACK_RPM_CHANGELOG_FILE
#
@@ -792,6 +805,26 @@
# * Mandatory : NO
# * Default : -
#
+# .. variable:: CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE
+#
+# Create a single debuginfo package even if components packaging is set.
+#
+# * Mandatory : NO
+# * Default : OFF
+#
+# When this variable is enabled it produces a single debuginfo package even if
+# component packaging is enabled.
+#
+# When using this feature in combination with components packaging and there is
+# more than one component this variable requires :variable:`CPACK_RPM_MAIN_COMPONENT`
+# to be set.
+#
+# .. note::
+#
+# If none of the :variable:`CPACK_RPM_<component>_DEBUGINFO_PACKAGE` variables
+# is set then :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` is automatically set to
+# ``ON`` when :variable:`CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE` is set.
+#
# Packaging of sources (SRPM)
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
@@ -1649,10 +1682,16 @@ function(cpack_rpm_generate_package)
endif()
if(CPACK_RPM_PACKAGE_COMPONENT)
- string(APPEND CPACK_RPM_PACKAGE_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}")
- cpack_rpm_variable_fallback("CPACK_RPM_PACKAGE_NAME"
- "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_NAME"
- "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_NAME")
+ string(TOUPPER "${CPACK_RPM_MAIN_COMPONENT}"
+ CPACK_RPM_MAIN_COMPONENT_UPPER)
+
+ if(NOT CPACK_RPM_MAIN_COMPONENT_UPPER STREQUAL CPACK_RPM_PACKAGE_COMPONENT_UPPER)
+ string(APPEND CPACK_RPM_PACKAGE_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}")
+
+ cpack_rpm_variable_fallback("CPACK_RPM_PACKAGE_NAME"
+ "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_NAME"
+ "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_NAME")
+ endif()
endif()
# CPACK_RPM_PACKAGE_VERSION (mandatory)
@@ -1807,6 +1846,12 @@ function(cpack_rpm_generate_package)
set(CPACK_RPM_PACKAGE_RELOCATABLE FALSE) # disable relocatable option if building source RPM
endif()
+ execute_process(
+ COMMAND "${RPMBUILD_EXECUTABLE}" --querytags
+ OUTPUT_VARIABLE RPMBUILD_TAG_LIST
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REPLACE "\n" ";" RPMBUILD_TAG_LIST "${RPMBUILD_TAG_LIST}")
+
# Check if additional fields for RPM spec header are given
# There may be some COMPONENT specific variables as well
# If component specific var is not provided we use the global one
@@ -1815,6 +1860,7 @@ function(cpack_rpm_generate_package)
if(CPACK_RPM_PACKAGE_DEBUG)
message("CPackRPM:Debug: processing ${_RPM_SPEC_HEADER}")
endif()
+
if(CPACK_RPM_PACKAGE_COMPONENT)
cpack_rpm_variable_fallback("CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}"
"CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}"
@@ -1822,9 +1868,24 @@ function(cpack_rpm_generate_package)
endif()
if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER})
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0057 NEW)
+ # Prefix can be replaced by Prefixes but the old version stil works so we'll ignore it for now
+ # Requires* is a special case because it gets transformed to Requires(pre/post/preun/postun)
+ # Auto* is a special case because the tags can not be queried by querytags rpmbuild flag
+ set(special_case_tags_ PREFIX REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN AUTOPROV AUTOREQ AUTOREQPROV)
+ if(NOT _RPM_SPEC_HEADER IN_LIST RPMBUILD_TAG_LIST AND NOT _RPM_SPEC_HEADER IN_LIST special_case_tags_)
+ cmake_policy(POP)
+ message(AUTHOR_WARNING "CPackRPM:Warning: ${_RPM_SPEC_HEADER} not "
+ "supported in provided rpmbuild. Tag will not be used.")
+ continue()
+ endif()
+ cmake_policy(POP)
+
if(CPACK_RPM_PACKAGE_DEBUG)
message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}")
endif()
+
set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}})
endif()
@@ -1996,7 +2057,8 @@ function(cpack_rpm_generate_package)
set(CPACK_RPM_USER_INSTALL_FILES "")
foreach(F IN LISTS CPACK_RPM_USER_FILELIST_INTERNAL)
string(REGEX REPLACE "%[A-Za-z]+(\\([^()]*\\))? " "" F_PATH ${F})
- string(REGEX MATCH "%[A-Za-z]+(\\([^()]*\\))?" F_PREFIX ${F})
+ string(REGEX MATCH "(%[A-Za-z]+(\\([^()]*\\))? )*" F_PREFIX ${F})
+ string(STRIP ${F_PREFIX} F_PREFIX)
if(CPACK_RPM_PACKAGE_DEBUG)
message("CPackRPM:Debug: F_PREFIX=<${F_PREFIX}>, F_PATH=<${F_PATH}>")
@@ -2059,7 +2121,7 @@ function(cpack_rpm_generate_package)
"CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_DEBUGINFO_PACKAGE"
"CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DEBUGINFO_PACKAGE"
"CPACK_RPM_DEBUGINFO_PACKAGE")
- if(CPACK_RPM_DEBUGINFO_PACKAGE)
+ if(CPACK_RPM_DEBUGINFO_PACKAGE OR (CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE AND NOT GENERATE_SPEC_PARTS))
cpack_rpm_variable_fallback("CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX"
"CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_BUILD_SOURCE_DIRS_PREFIX"
"CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_BUILD_SOURCE_DIRS_PREFIX"
@@ -2067,9 +2129,81 @@ function(cpack_rpm_generate_package)
if(NOT CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX)
set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX "/usr/src/debug/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}")
endif()
- cpack_rpm_debugsymbol_check("${CPACK_RPM_INSTALL_FILES}" "${WDIR}")
- set(TMP_RPM_DEBUGINFO "
+ if(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE AND GENERATE_SPEC_PARTS)
+ file(WRITE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_COMPONENT}.files"
+ "${CPACK_RPM_INSTALL_FILES}")
+ else()
+ if(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE AND CPACK_RPM_PACKAGE_COMPONENT)
+ # this part is only required by components packaging - with monolithic
+ # packages we can be certain that there are no other components present
+ # so CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE is a noop
+ if(CPACK_RPM_DEBUGINFO_PACKAGE)
+ # only add current package files to debuginfo list if debuginfo
+ # generation is enabled for current package
+ set(install_files_ "${CPACK_RPM_INSTALL_FILES}")
+ else()
+ unset(install_files_)
+ endif()
+
+ file(GLOB files_ "${CPACK_RPM_DIRECTORY}/SPECS/*.files")
+
+ foreach(f_ IN LISTS files_)
+ file(READ "${f_}" tmp_)
+ string(APPEND install_files_ ";${tmp_}")
+ endforeach()
+
+ # if there were other components/groups so we need to move files from them
+ # to current component otherwise those files won't be found
+ file(GLOB components_ LIST_DIRECTORIES true RELATIVE
+ "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}"
+ "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/*")
+ foreach(component_ IN LISTS components_)
+ string(TOUPPER "${component_}" component_dir_upper_)
+ if(component_dir_upper_ STREQUAL CPACK_RPM_PACKAGE_COMPONENT_UPPER)
+ # skip current component
+ continue()
+ endif()
+
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0009 NEW)
+ file(GLOB_RECURSE files_for_move_ LIST_DIRECTORIES false RELATIVE
+ "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}"
+ "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}/*")
+ cmake_policy(POP)
+
+ foreach(f_ IN LISTS files_for_move_)
+ get_filename_component(dir_path_ "${f_}" DIRECTORY)
+ set(src_file_
+ "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}/${f_}")
+
+ # check that we are not overriding an existing file that doesn't
+ # match the file that we want to copy
+ if(EXISTS "${src_file_}" AND EXISTS "${WDIR}/${f_}")
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} -E compare_files "${src_file_}" "${WDIR}/${f_}"
+ RESULT_VARIABLE res_
+ )
+ if(res_)
+ message(FATAL_ERROR "CPackRPM:Error: File on path '${WDIR}/${f_}'"
+ " already exists but is a different than the one in component"
+ " '${component_}'! Packages will not be generated.")
+ endif()
+ endif()
+
+ file(MAKE_DIRECTORY "${WDIR}/${dir_path_}")
+ file(RENAME "${src_file_}"
+ "${WDIR}/${f_}")
+ endforeach()
+ endforeach()
+
+ cpack_rpm_debugsymbol_check("${install_files_}" "${WDIR}")
+ else()
+ cpack_rpm_debugsymbol_check("${CPACK_RPM_INSTALL_FILES}" "${WDIR}")
+ endif()
+
+ if(TMP_DEBUGINFO_ADDITIONAL_SOURCES)
+ set(TMP_RPM_DEBUGINFO "
# Modified version of %%debug_package macro
# defined in /usr/lib/rpm/macros as that one
# can't handle injection of extra source files.
@@ -2088,6 +2222,15 @@ package or when debugging this package.
${TMP_DEBUGINFO_ADDITIONAL_SOURCES}
%endif
")
+ elseif(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE)
+ message(AUTHOR_WARNING "CPackRPM:Warning: debuginfo package was requested"
+ " but will not be generated as no source files were found!")
+ else()
+ message(AUTHOR_WARNING "CPackRPM:Warning: debuginfo package was requested"
+ " but will not be generated as no source files were found! Component: '"
+ "${CPACK_RPM_PACKAGE_COMPONENT}'.")
+ endif()
+ endif()
endif()
# Prepare install files
@@ -2164,12 +2307,25 @@ ${TMP_DEBUGINFO_ADDITIONAL_SOURCES}
cmake_policy(POP)
else()
# old file name format for back compatibility
- set(CPACK_RPM_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}")
+ string(TOUPPER "${CPACK_RPM_MAIN_COMPONENT}"
+ CPACK_RPM_MAIN_COMPONENT_UPPER)
+
+ if(CPACK_RPM_MAIN_COMPONENT_UPPER STREQUAL CPACK_RPM_PACKAGE_COMPONENT_UPPER)
+ # this is the main component so ignore the component filename part
+ set(CPACK_RPM_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.rpm")
+ else()
+ set(CPACK_RPM_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}")
+ endif()
endif()
# else example:
#set(CPACK_RPM_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}-${CPACK_RPM_PACKAGE_ARCHITECTURE}.rpm")
- if(NOT CPACK_RPM_DEBUGINFO_PACKAGE)
+ if(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE AND GENERATE_SPEC_PARTS)
+ string(TOLOWER "${CPACK_RPM_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.*\\.rpm" expected_filename_)
+
+ file(WRITE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_COMPONENT}.rpm_name"
+ "${expected_filename_};${CPACK_RPM_FILE_NAME}")
+ elseif(NOT CPACK_RPM_DEBUGINFO_PACKAGE)
set(FILE_NAME_DEFINE "%define _rpmfilename ${CPACK_RPM_FILE_NAME}")
endif()
endif()
@@ -2264,13 +2420,61 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
\@CPACK_RPM_SPEC_CHANGELOG\@
"
)
+
+ elseif(GENERATE_SPEC_PARTS) # binary rpm with single debuginfo package
+ file(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in
+ "# -*- rpm-spec -*-
+%package -n \@CPACK_RPM_PACKAGE_NAME\@
+Summary: \@CPACK_RPM_PACKAGE_SUMMARY\@
+Version: \@CPACK_RPM_PACKAGE_VERSION\@
+Release: \@CPACK_RPM_PACKAGE_RELEASE\@
+License: \@CPACK_RPM_PACKAGE_LICENSE\@
+Group: \@CPACK_RPM_PACKAGE_GROUP\@
+Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
+
+\@TMP_RPM_URL\@
+\@TMP_RPM_REQUIRES\@
+\@TMP_RPM_REQUIRES_PRE\@
+\@TMP_RPM_REQUIRES_POST\@
+\@TMP_RPM_REQUIRES_PREUN\@
+\@TMP_RPM_REQUIRES_POSTUN\@
+\@TMP_RPM_PROVIDES\@
+\@TMP_RPM_OBSOLETES\@
+\@TMP_RPM_CONFLICTS\@
+\@TMP_RPM_SUGGESTS\@
+\@TMP_RPM_AUTOPROV\@
+\@TMP_RPM_AUTOREQ\@
+\@TMP_RPM_AUTOREQPROV\@
+\@TMP_RPM_BUILDARCH\@
+\@TMP_RPM_PREFIXES\@
+
+%description -n \@CPACK_RPM_PACKAGE_NAME\@
+\@CPACK_RPM_PACKAGE_DESCRIPTION\@
+
+%files -n \@CPACK_RPM_PACKAGE_NAME\@
+%defattr(\@TMP_DEFAULT_FILE_PERMISSIONS\@,\@TMP_DEFAULT_USER\@,\@TMP_DEFAULT_GROUP\@,\@TMP_DEFAULT_DIR_PERMISSIONS\@)
+\@CPACK_RPM_INSTALL_FILES\@
+\@CPACK_RPM_ABSOLUTE_INSTALL_FILES\@
+\@CPACK_RPM_USER_INSTALL_FILES\@
+"
+ )
+
else() # binary rpm
+ if(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE)
+ # find generated spec file and take its name
+ file(GLOB spec_files_ "${CPACK_RPM_DIRECTORY}/SPECS/*.spec")
+
+ foreach(f_ IN LISTS spec_files_)
+ file(READ "${f_}" tmp_)
+ string(APPEND TMP_OTHER_COMPONENTS "\n${tmp_}\n")
+ endforeach()
+ endif()
# We should generate a USER spec file template:
# - either because the user asked for it : CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
# - or the user did not provide one : NOT CPACK_RPM_USER_BINARY_SPECFILE
+ set(RPMBUILD_FLAGS "-bb")
if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE)
- set(RPMBUILD_FLAGS "-bb")
file(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in
"# -*- rpm-spec -*-
@@ -2292,6 +2496,7 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
\@TMP_RPM_PROVIDES\@
\@TMP_RPM_OBSOLETES\@
\@TMP_RPM_CONFLICTS\@
+\@TMP_RPM_SUGGESTS\@
\@TMP_RPM_AUTOPROV\@
\@TMP_RPM_AUTOREQ\@
\@TMP_RPM_AUTOREQPROV\@
@@ -2350,6 +2555,8 @@ mv %_topdir/tmpBBroot $RPM_BUILD_ROOT
%changelog
\@CPACK_RPM_SPEC_CHANGELOG\@
+
+\@TMP_OTHER_COMPONENTS\@
"
)
endif()
@@ -2376,60 +2583,90 @@ mv %_topdir/tmpBBroot $RPM_BUILD_ROOT
configure_file(${CPACK_RPM_BINARY_SPECFILE}.in ${CPACK_RPM_BINARY_SPECFILE} @ONLY)
endif()
- if(RPMBUILD_EXECUTABLE)
- # Now call rpmbuild using the SPECFILE
- execute_process(
- COMMAND "${RPMBUILD_EXECUTABLE}" ${RPMBUILD_FLAGS}
- --define "_topdir ${CPACK_RPM_DIRECTORY}"
- --buildroot "%_topdir/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}"
- --target "${CPACK_RPM_PACKAGE_ARCHITECTURE}"
- "${CPACK_RPM_BINARY_SPECFILE}"
- WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}"
- RESULT_VARIABLE CPACK_RPMBUILD_EXEC_RESULT
- ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err"
- OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out")
- if(CPACK_RPM_PACKAGE_DEBUG OR CPACK_RPMBUILD_EXEC_RESULT)
- file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err RPMBUILDERR)
- file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out RPMBUILDOUT)
- message("CPackRPM:Debug: You may consult rpmbuild logs in: ")
- message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err")
- message("CPackRPM:Debug: *** ${RPMBUILDERR} ***")
- message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out")
- message("CPackRPM:Debug: *** ${RPMBUILDOUT} ***")
+ if(NOT GENERATE_SPEC_PARTS) # generate package
+ if(RPMBUILD_EXECUTABLE)
+ # Now call rpmbuild using the SPECFILE
+ execute_process(
+ COMMAND "${RPMBUILD_EXECUTABLE}" ${RPMBUILD_FLAGS}
+ --define "_topdir ${CPACK_RPM_DIRECTORY}"
+ --buildroot "%_topdir/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}"
+ --target "${CPACK_RPM_PACKAGE_ARCHITECTURE}"
+ "${CPACK_RPM_BINARY_SPECFILE}"
+ WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}"
+ RESULT_VARIABLE CPACK_RPMBUILD_EXEC_RESULT
+ ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err"
+ OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out")
+ if(CPACK_RPM_PACKAGE_DEBUG OR CPACK_RPMBUILD_EXEC_RESULT)
+ file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err RPMBUILDERR)
+ file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out RPMBUILDOUT)
+ message("CPackRPM:Debug: You may consult rpmbuild logs in: ")
+ message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err")
+ message("CPackRPM:Debug: *** ${RPMBUILDERR} ***")
+ message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out")
+ message("CPackRPM:Debug: *** ${RPMBUILDOUT} ***")
+ endif()
+ else()
+ if(ALIEN_EXECUTABLE)
+ message(FATAL_ERROR "RPM packaging through alien not done (yet)")
+ endif()
endif()
- else()
- if(ALIEN_EXECUTABLE)
- message(FATAL_ERROR "RPM packaging through alien not done (yet)")
+
+ # find generated rpm files and take their names
+ cmake_policy(PUSH)
+ # Tell file(GLOB_RECURSE) not to follow directory symlinks
+ # even if the project does not set this policy to NEW.
+ cmake_policy(SET CMP0009 NEW)
+ file(GLOB_RECURSE GENERATED_FILES "${CPACK_RPM_DIRECTORY}/RPMS/*.rpm"
+ "${CPACK_RPM_DIRECTORY}/SRPMS/*.rpm")
+ cmake_policy(POP)
+
+ if(NOT GENERATED_FILES)
+ message(FATAL_ERROR "RPM package was not generated! ${CPACK_RPM_DIRECTORY}")
endif()
- endif()
- # find generated rpm files and take their names
- cmake_policy(PUSH)
- # Tell file(GLOB_RECURSE) not to follow directory symlinks
- # even if the project does not set this policy to NEW.
- cmake_policy(SET CMP0009 NEW)
- file(GLOB_RECURSE GENERATED_FILES "${CPACK_RPM_DIRECTORY}/RPMS/*.rpm"
- "${CPACK_RPM_DIRECTORY}/SRPMS/*.rpm")
- cmake_policy(POP)
+ unset(expected_filenames_)
+ unset(filenames_)
+ if(CPACK_RPM_DEBUGINFO_PACKAGE AND NOT CPACK_RPM_FILE_NAME STREQUAL "RPM-DEFAULT")
+ string(TOLOWER "${CPACK_RPM_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.*\\.rpm" efn_)
+ list(APPEND expected_filenames_ "${efn_}")
+ list(APPEND filenames_ "${CPACK_RPM_FILE_NAME}")
+ endif()
- if(NOT GENERATED_FILES)
- message(FATAL_ERROR "RPM package was not generated! ${CPACK_RPM_DIRECTORY}")
- endif()
+ # check if other files have to be renamed
+ file(GLOB rename_files_ "${CPACK_RPM_DIRECTORY}/SPECS/*.rpm_name")
+ if(rename_files_)
+ foreach(f_ IN LISTS rename_files_)
+ file(READ "${f_}" tmp_)
+ list(GET tmp_ 0 efn_)
+ list(APPEND expected_filenames_ "${efn_}")
+ list(GET tmp_ 1 fn_)
+ list(APPEND filenames_ "${fn_}")
+ endforeach()
+ endif()
- if(CPACK_RPM_DEBUGINFO_PACKAGE AND NOT CPACK_RPM_FILE_NAME STREQUAL "RPM-DEFAULT")
- string(TOLOWER "${CPACK_RPM_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.*\\.rpm" EXPECTED_FILENAME)
+ if(expected_filenames_)
+ foreach(F IN LISTS GENERATED_FILES)
+ unset(matched_)
+ foreach(expected_ IN LISTS expected_filenames_)
+ if(F MATCHES ".*/${expected_}")
+ list(FIND expected_filenames_ "${expected_}" idx_)
+ list(GET filenames_ ${idx_} filename_)
+ get_filename_component(FILE_PATH "${F}" DIRECTORY)
+ file(RENAME "${F}" "${FILE_PATH}/${filename_}")
+ list(APPEND new_files_list_ "${FILE_PATH}/${filename_}")
+ set(matched_ "YES")
+
+ break()
+ endif()
+ endforeach()
- foreach(F IN LISTS GENERATED_FILES)
- if(F MATCHES ".*/${EXPECTED_FILENAME}")
- get_filename_component(FILE_PATH "${F}" DIRECTORY)
- file(RENAME "${F}" "${FILE_PATH}/${CPACK_RPM_FILE_NAME}")
- list(APPEND new_files_list_ "${FILE_PATH}/${CPACK_RPM_FILE_NAME}")
- else()
- list(APPEND new_files_list_ "${F}")
- endif()
- endforeach()
+ if(NOT matched_)
+ list(APPEND new_files_list_ "${F}")
+ endif()
+ endforeach()
- set(GENERATED_FILES "${new_files_list_}")
+ set(GENERATED_FILES "${new_files_list_}")
+ endif()
endif()
set(GEN_CPACK_OUTPUT_FILES "${GENERATED_FILES}" PARENT_SCOPE)
diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake
index 8451a6a..1203be4 100644
--- a/Modules/CTestCoverageCollectGCOV.cmake
+++ b/Modules/CTestCoverageCollectGCOV.cmake
@@ -65,7 +65,6 @@
# Suppress non-error messages that otherwise would have been
# printed out by this function.
-include(CMakeParseArguments)
function(ctest_coverage_collect_gcov)
set(options QUIET GLOB DELETE)
set(oneValueArgs TARBALL SOURCE BUILD GCOV_COMMAND)
diff --git a/Modules/CTestUseLaunchers.cmake b/Modules/CTestUseLaunchers.cmake
index 1cf20eb..dc90513 100644
--- a/Modules/CTestUseLaunchers.cmake
+++ b/Modules/CTestUseLaunchers.cmake
@@ -24,7 +24,9 @@
# include(CTestUseLaunchers), it will use the value of the ENV variable
# to initialize a CTEST_USE_LAUNCHERS cache variable. This cache
# variable initialization only occurs if CTEST_USE_LAUNCHERS is not
-# already defined.
+# already defined. If CTEST_USE_LAUNCHERS is on in a ctest -S script
+# the ctest_configure command will add -DCTEST_USE_LAUNCHERS:BOOL=TRUE
+# to the cmake command used to configure the project.
if(NOT DEFINED CTEST_USE_LAUNCHERS AND DEFINED ENV{CTEST_USE_LAUNCHERS_DEFAULT})
set(CTEST_USE_LAUNCHERS "$ENV{CTEST_USE_LAUNCHERS_DEFAULT}"
diff --git a/Modules/CheckFunctionExists.c b/Modules/CheckFunctionExists.c
index 2304000..224e340 100644
--- a/Modules/CheckFunctionExists.c
+++ b/Modules/CheckFunctionExists.c
@@ -4,7 +4,7 @@
extern "C"
#endif
char
- CHECK_FUNCTION_EXISTS();
+ CHECK_FUNCTION_EXISTS(void);
#ifdef __CLASSIC_C__
int main()
{
diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake
index 5f049e7..ef08062 100644
--- a/Modules/CheckFunctionExists.cmake
+++ b/Modules/CheckFunctionExists.cmake
@@ -5,18 +5,16 @@
# CheckFunctionExists
# -------------------
#
-# Check if a C function can be linked
+# Check if a C function can be linked::
#
-# CHECK_FUNCTION_EXISTS(<function> <variable>)
+# check_function_exists(<function> <variable>)
#
-# Check that the <function> is provided by libraries on the system and
-# store the result in a <variable>. This does not verify that any
-# system header file declares the function, only that it can be found at
-# link time (consider using CheckSymbolExists).
-# <variable> will be created as an internal cache variable.
+# Check that the ``<function>`` is provided by libraries on the system and store
+# the result in a ``<variable>``. ``<variable>`` will be created as an internal
+# cache variable.
#
-# The following variables may be set before calling this macro to modify
-# the way the check is run:
+# The following variables may be set before calling this macro to modify the
+# way the check is run:
#
# ::
#
@@ -25,6 +23,20 @@
# CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
# CMAKE_REQUIRED_QUIET = execute quietly without messages
+#
+# .. note::
+#
+# Prefer using :Module:`CheckSymbolExists` instead of this module,
+# for the following reasons:
+#
+# * ``check_function_exists()`` can't detect functions that are inlined
+# in headers or specified as a macro.
+#
+# * ``check_function_exists()`` can't detect anything in the 32-bit
+# versions of the Win32 API, because of a mismatch in calling conventions.
+#
+# * ``check_function_exists()`` only verifies linking, it does not verify
+# that the function is declared in system headers.
macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}")
diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake
index 1cc72c0..f874e74 100644
--- a/Modules/Compiler/AppleClang-C.cmake
+++ b/Modules/Compiler/AppleClang-C.cmake
@@ -25,18 +25,16 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
endif()
macro(cmake_record_c_compile_features)
- macro(_get_appleclang_features std_version list)
- record_compiler_features(C "${std_version}" ${list})
- endmacro()
-
set(_result 0)
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
- _get_appleclang_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES)
if (_result EQUAL 0)
- _get_appleclang_features(${CMAKE_C99_STANDARD_COMPILE_OPTION} CMAKE_C99_COMPILE_FEATURES)
+ _record_compiler_features_c(11)
+ endif()
+ if (_result EQUAL 0)
+ _record_compiler_features_c(99)
endif()
if (_result EQUAL 0)
- _get_appleclang_features(${CMAKE_C90_STANDARD_COMPILE_OPTION} CMAKE_C90_COMPILE_FEATURES)
+ _record_compiler_features_c(90)
endif()
endif()
endmacro()
diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake
index 95bc79a..ee900ae 100644
--- a/Modules/Compiler/AppleClang-CXX.cmake
+++ b/Modules/Compiler/AppleClang-CXX.cmake
@@ -22,6 +22,11 @@ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
endif()
+if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1)
+ set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++1z")
+ set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
+endif()
+
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
if (NOT CMAKE_CXX_COMPILER_FORCED)
if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT)
@@ -36,21 +41,19 @@ endif()
macro(cmake_record_cxx_compile_features)
- macro(_get_appleclang_features std_version list)
- record_compiler_features(CXX "${std_version}" ${list})
- endmacro()
-
set(_result 0)
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
- set(_result 0)
- if(CMAKE_CXX14_STANDARD_COMPILE_OPTION)
- _get_appleclang_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES)
+ if(_result EQUAL 0 AND CMAKE_CXX17_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_cxx(17)
+ endif()
+ if(_result EQUAL 0 AND CMAKE_CXX14_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_cxx(14)
endif()
if (_result EQUAL 0)
- _get_appleclang_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES)
+ _record_compiler_features_cxx(11)
endif()
if (_result EQUAL 0)
- _get_appleclang_features(${CMAKE_CXX98_STANDARD_COMPILE_OPTION} CMAKE_CXX98_COMPILE_FEATURES)
+ _record_compiler_features_cxx(98)
endif()
endif()
endmacro()
diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake
index d8b7743..bcd9218 100644
--- a/Modules/Compiler/Clang-C.cmake
+++ b/Modules/Compiler/Clang-C.cmake
@@ -34,18 +34,16 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
endif()
macro(cmake_record_c_compile_features)
- macro(_get_clang_features std_version list)
- record_compiler_features(C "${std_version}" ${list})
- endmacro()
-
set(_result 0)
if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
- _get_clang_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES)
if (_result EQUAL 0)
- _get_clang_features(${CMAKE_C99_STANDARD_COMPILE_OPTION} CMAKE_C99_COMPILE_FEATURES)
+ _record_compiler_features_c(11)
+ endif()
+ if (_result EQUAL 0)
+ _record_compiler_features_c(99)
endif()
if (_result EQUAL 0)
- _get_clang_features(${CMAKE_C90_STANDARD_COMPILE_OPTION} CMAKE_C90_COMPILE_FEATURES)
+ _record_compiler_features_c(90)
endif()
endif()
endmacro()
diff --git a/Modules/Compiler/Clang-CXX-FeatureTests.cmake b/Modules/Compiler/Clang-CXX-FeatureTests.cmake
index df2e1a8..cd04190 100644
--- a/Modules/Compiler/Clang-CXX-FeatureTests.cmake
+++ b/Modules/Compiler/Clang-CXX-FeatureTests.cmake
@@ -2,7 +2,7 @@
# Reference: http://clang.llvm.org/cxx_status.html
# http://clang.llvm.org/docs/LanguageExtensions.html
-set(_cmake_oldestSupported "((__clang_major__ * 100) + __clang_minor__) >= 304")
+set(_cmake_oldestSupported "((__clang_major__ * 100) + __clang_minor__) >= 301")
include("${CMAKE_CURRENT_LIST_DIR}/Clang-CXX-TestableFeatures.cmake")
@@ -15,7 +15,6 @@ set(_cmake_feature_test_cxx_digit_separators "${Clang34_CXX14}")
# http://llvm.org/bugs/show_bug.cgi?id=19674
set(_cmake_feature_test_cxx_generic_lambdas "${Clang34_CXX14}")
-# TODO: Should be supported by Clang 3.1
set(Clang31_CXX11 "${_cmake_oldestSupported} && __cplusplus >= 201103L")
set(_cmake_feature_test_cxx_enum_forward_declarations "${Clang31_CXX11}")
set(_cmake_feature_test_cxx_sizeof_member "${Clang31_CXX11}")
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
index dc62711..8ed3695 100644
--- a/Modules/Compiler/Clang-CXX.cmake
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -31,7 +31,12 @@ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
endif()
-if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
+if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)
+ set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++1z")
+ set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
+endif()
+
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.1)
if (NOT CMAKE_CXX_COMPILER_FORCED)
if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT)
message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}")
@@ -44,18 +49,19 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
endif()
macro(cmake_record_cxx_compile_features)
- macro(_get_clang_features std_version list)
- record_compiler_features(CXX "${std_version}" ${list})
- endmacro()
-
set(_result 0)
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
- _get_clang_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES)
- if (_result EQUAL 0)
- _get_clang_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES)
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.1)
+ if(_result EQUAL 0 AND CMAKE_CXX17_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_cxx(17)
+ endif()
+ if(_result EQUAL 0 AND CMAKE_CXX14_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_cxx(14)
+ endif()
+ if (_result EQUAL 0 AND CMAKE_CXX11_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_cxx(11)
endif()
if (_result EQUAL 0)
- _get_clang_features(${CMAKE_CXX98_STANDARD_COMPILE_OPTION} CMAKE_CXX98_COMPILE_FEATURES)
+ _record_compiler_features_cxx(98)
endif()
endif()
endmacro()
diff --git a/Modules/Compiler/GNU-DetermineCompiler.cmake b/Modules/Compiler/GNU-C-DetermineCompiler.cmake
index 6ddc566..6ddc566 100644
--- a/Modules/Compiler/GNU-DetermineCompiler.cmake
+++ b/Modules/Compiler/GNU-C-DetermineCompiler.cmake
diff --git a/Modules/Compiler/GNU-C-FeatureTests.cmake b/Modules/Compiler/GNU-C-FeatureTests.cmake
index b3fe33f..0ab5265 100644
--- a/Modules/Compiler/GNU-C-FeatureTests.cmake
+++ b/Modules/Compiler/GNU-C-FeatureTests.cmake
@@ -1,5 +1,5 @@
-set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404")
+set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 304")
# GNU 4.7 correctly sets __STDC_VERSION__ to 201112L, but GNU 4.6 sets it
# to 201000L. As the former is strictly greater than the latter, test only
@@ -8,10 +8,10 @@ set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404")
# to the distinction between __cplusplus and __GXX_EXPERIMENTAL_CXX0X__ tests.
set(GNU46_C11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201000L")
set(_cmake_feature_test_c_static_assert "${GNU46_C11}")
-# Since 4.4 at least:
-set(GNU44_C99 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L")
-set(_cmake_feature_test_c_restrict "${GNU44_C99}")
-set(_cmake_feature_test_c_variadic_macros "${GNU44_C99}")
+# Since 3.4 at least:
+set(GNU34_C99 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L")
+set(_cmake_feature_test_c_restrict "${GNU34_C99}")
+set(_cmake_feature_test_c_variadic_macros "${GNU34_C99}")
set(GNU_C90 "${_cmake_oldestSupported}")
set(_cmake_feature_test_c_function_prototypes "${GNU_C90}")
diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake
index 2c478da..3f02618 100644
--- a/Modules/Compiler/GNU-C.cmake
+++ b/Modules/Compiler/GNU-C.cmake
@@ -4,12 +4,12 @@ __compiler_gnu(C)
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5)
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
-elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
+elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89")
endif()
-if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
+if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
endif()
@@ -22,7 +22,7 @@ elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu1x")
endif()
-if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
+if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
if (NOT CMAKE_C_COMPILER_FORCED)
if (NOT CMAKE_C_STANDARD_COMPUTED_DEFAULT)
message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}")
@@ -38,22 +38,17 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
endif()
endif()
-
macro(cmake_record_c_compile_features)
- macro(_get_gcc_features std_version list)
- record_compiler_features(C "${std_version}" ${list})
- endmacro()
-
set(_result 0)
- if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
- _get_gcc_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES)
- endif()
- if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
+ if(_result EQUAL 0 AND CMAKE_C11_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_c(11)
+ endif()
if (_result EQUAL 0)
- _get_gcc_features(${CMAKE_C99_STANDARD_COMPILE_OPTION} CMAKE_C99_COMPILE_FEATURES)
+ _record_compiler_features_c(99)
endif()
if (_result EQUAL 0)
- _get_gcc_features(${CMAKE_C90_STANDARD_COMPILE_OPTION} CMAKE_C90_COMPILE_FEATURES)
+ _record_compiler_features_c(90)
endif()
endif()
endmacro()
diff --git a/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake b/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake
new file mode 100644
index 0000000..c25b147
--- /dev/null
+++ b/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake
@@ -0,0 +1,15 @@
+
+set(_compiler_id_pp_test "defined(__GNUC__) || defined(__GNUG__)")
+
+set(_compiler_id_version_compute "
+# if defined(__GNUC__)
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__GNUC__)
+# else
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__GNUG__)
+# endif
+# if defined(__GNUC_MINOR__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__GNUC_MINOR__)
+# endif
+# if defined(__GNUC_PATCHLEVEL__)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__GNUC_PATCHLEVEL__)
+# endif")
diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake
index e1c555b..c007c98 100644
--- a/Modules/Compiler/GNU-CXX.cmake
+++ b/Modules/Compiler/GNU-CXX.cmake
@@ -6,7 +6,7 @@ if (WIN32)
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fno-keep-inline-dllexport")
endif()
else()
- if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.2)
+ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
endif()
endif()
@@ -34,6 +34,11 @@ elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
endif()
+if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
+ set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++1z")
+ set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
+endif()
+
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
if (NOT CMAKE_CXX_COMPILER_FORCED)
if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT)
@@ -47,20 +52,19 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
endif()
macro(cmake_record_cxx_compile_features)
- macro(_get_gcc_features std_version list)
- record_compiler_features(CXX "${std_version}" ${list})
- endmacro()
-
set(_result 0)
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
- _get_gcc_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES)
- endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
+ if(_result EQUAL 0 AND CMAKE_CXX17_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_cxx(17)
+ endif()
+ if(_result EQUAL 0 AND CMAKE_CXX14_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_cxx(14)
+ endif()
if (_result EQUAL 0)
- _get_gcc_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES)
+ _record_compiler_features_cxx(11)
endif()
if (_result EQUAL 0)
- _get_gcc_features(${CMAKE_CXX98_STANDARD_COMPILE_OPTION} CMAKE_CXX98_COMPILE_FEATURES)
+ _record_compiler_features_cxx(98)
endif()
endif()
endmacro()
diff --git a/Modules/Compiler/Intel-C-FeatureTests.cmake b/Modules/Compiler/Intel-C-FeatureTests.cmake
index 34175c8..5d09767 100644
--- a/Modules/Compiler/Intel-C-FeatureTests.cmake
+++ b/Modules/Compiler/Intel-C-FeatureTests.cmake
@@ -3,15 +3,11 @@
# - https://software.intel.com/en-us/articles/c99-support-in-intel-c-compiler
# - https://software.intel.com/en-us/articles/c11-support-in-intel-c-compiler
-# FIXME: Intel C feature detection works only when simulating the GNU compiler.
-if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
- return()
-endif()
-
set(DETECT_C99 "defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L")
+set(DETECT_C11 "defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L")
#static assert is only around in version 1500 update 2 and above
-set(_cmake_feature_test_c_static_assert "(__INTEL_COMPILER > 1500 || (__INTEL_COMPILER == 1500 && __INTEL_COMPILER_UPDATE > 1) ) && ${DETECT_C99}")
+set(_cmake_feature_test_c_static_assert "(__INTEL_COMPILER > 1500 || (__INTEL_COMPILER == 1500 && __INTEL_COMPILER_UPDATE > 1) ) && (${DETECT_C11} || ${DETECT_C99} && !defined(_MSC_VER))")
set(_cmake_oldestSupported "__INTEL_COMPILER >= 1110")
set(Intel_C99 "${_cmake_oldestSupported} && ${DETECT_C99}")
@@ -21,3 +17,4 @@ set(_cmake_feature_test_c_function_prototypes "${_cmake_oldestSupported}")
unset(Intel_C99)
unset(DETECT_C99)
+unset(DETECT_C11)
diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake
index 61adf40..9c67fbd 100644
--- a/Modules/Compiler/Intel-C.cmake
+++ b/Modules/Compiler/Intel-C.cmake
@@ -10,14 +10,17 @@ set(CMAKE_DEPFILE_FLAGS_C "-MD -MT <OBJECT> -MF <DEPFILE>")
if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
set(_std -Qstd)
set(_ext c)
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 16.0.0)
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-Qstd=c11")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-Qstd=c11")
+ endif()
else()
set(_std -std)
set(_ext gnu)
-endif()
-
-if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0)
- set(CMAKE_C11_STANDARD_COMPILE_OPTION "${_std}=c11")
- set(CMAKE_C11_EXTENSION_COMPILE_OPTION "${_std}=${_ext}11")
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0)
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
+ endif()
endif()
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.0)
@@ -47,21 +50,16 @@ unset(_std)
unset(_ext)
macro(cmake_record_c_compile_features)
- macro(_get_intel_c_features std_version list)
- record_compiler_features(C "${std_version}" ${list})
- endmacro()
-
set(_result 0)
- if (NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" AND
- NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1)
- if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0)
- _get_intel_c_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES)
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1)
+ if (_result EQUAL 0 AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0)
+ _record_compiler_features_C(11)
endif()
if (_result EQUAL 0)
- _get_intel_c_features(${CMAKE_C99_STANDARD_COMPILE_OPTION} CMAKE_C99_COMPILE_FEATURES)
+ _record_compiler_features_C(99)
endif()
if (_result EQUAL 0)
- _get_intel_c_features(${CMAKE_C90_STANDARD_COMPILE_OPTION} CMAKE_C90_COMPILE_FEATURES)
+ _record_compiler_features_C(90)
endif()
endif()
endmacro()
diff --git a/Modules/Compiler/Intel-CXX-FeatureTests.cmake b/Modules/Compiler/Intel-CXX-FeatureTests.cmake
index 57a05c8..e370647 100644
--- a/Modules/Compiler/Intel-CXX-FeatureTests.cmake
+++ b/Modules/Compiler/Intel-CXX-FeatureTests.cmake
@@ -3,11 +3,14 @@
# - https://software.intel.com/en-us/articles/c14-features-supported-by-intel-c-compiler
# - http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0096r3.html
-# FIXME: Intel C++ feature detection works only when simulating the GNU compiler.
-# When simulating MSVC, Intel always sets __cplusplus to 199711L.
-if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
- return()
-endif()
+# Notes:
+# [1] Some Intel versions define some feature macros under -std=gnu++98
+# that do not work in that mode (or work with warnings):
+# - __cpp_attributes 200809
+# - __cpp_init_captures 201304
+# - __cpp_lambdas 200907
+# - __cpp_rvalue_references 200610
+# - __cpp_variadic_templates 200704
set(_cmake_feature_test_cxx_variable_templates "__cpp_variable_templates >= 201304")
set(_cmake_feature_test_cxx_relaxed_constexpr "__cpp_constexpr >= 201304")
@@ -18,44 +21,50 @@ set(DETECT_CXX11 "((__cplusplus >= 201103L) || defined(__INTEL_CXX11_MODE__) ||
#if you are compiling as 98/11/14. So to properly detect C++14 with this version
#we look for the existence of __GXX_EXPERIMENTAL_CXX0X__ but not __INTEL_CXX11_MODE__
set(DETECT_BUGGY_ICC15 "((__INTEL_COMPILER == 1500) && (__INTEL_COMPILER_UPDATE == 1))")
-set(DETECT_CXX14 "((__cplusplus >= 201300L) || ((__cplusplus == 201103L) && !defined(__INTEL_CXX11_MODE__)) || ((${DETECT_BUGGY_ICC15}) && defined(__GXX_EXPERIMENTAL_CXX0X__) && !defined(__INTEL_CXX11_MODE__) ) )")
+set(DETECT_CXX14 "((__cplusplus >= 201300L) || ((__cplusplus == 201103L) && !defined(__INTEL_CXX11_MODE__)) || ((${DETECT_BUGGY_ICC15}) && defined(__GXX_EXPERIMENTAL_CXX0X__) && !defined(__INTEL_CXX11_MODE__) ) || (defined(__INTEL_CXX11_MODE__) && defined(__cpp_aggregate_nsdmi)) )")
+unset(DETECT_BUGGY_ICC15)
set(Intel16_CXX14 "__INTEL_COMPILER >= 1600 && ${DETECT_CXX14}")
set(_cmake_feature_test_cxx_aggregate_default_initializers "${Intel16_CXX14}")
set(_cmake_feature_test_cxx_contextual_conversions "${Intel16_CXX14}")
-set(_cmake_feature_test_cxx_generic_lambdas "${Intel16_CXX14}")
+set(_cmake_feature_test_cxx_generic_lambdas "__cpp_generic_lambdas >= 201304")
set(_cmake_feature_test_cxx_digit_separators "${Intel16_CXX14}")
# This test is supposed to work in Intel 14 but the compiler has a bug
# in versions 14 and 15::
# https://software.intel.com/en-us/forums/intel-c-compiler/topic/600514
-# It also appears to fail with an internal compiler error on Intel 16.
+# It also appears to fail with an internal compiler error on Intel 16 and 17.
#set(_cmake_feature_test_cxx_generalized_initializers "${Intel16_CXX14}")
+unset(Intel16_CXX14)
-set(Intel15_CXX14 "__INTEL_COMPILER >= 1500 && ${DETECT_CXX14}")
-set(_cmake_feature_test_cxx_decltype_auto "${Intel15_CXX14}")
-set(_cmake_feature_test_cxx_lambda_init_captures "${Intel15_CXX14}")
+set(Intel15 "__INTEL_COMPILER >= 1500")
+set(Intel15_CXX14 "${Intel15} && ${DETECT_CXX14}")
+set(_cmake_feature_test_cxx_decltype_auto "__cpp_decltype_auto >= 201304 || ${Intel15_CXX14}")
+set(_cmake_feature_test_cxx_lambda_init_captures "(__cpp_init_captures >= 201304 || ${Intel15}) && ${DETECT_CXX14}") # [1]
set(_cmake_feature_test_cxx_attribute_deprecated "${Intel15_CXX14}")
-set(_cmake_feature_test_cxx_return_type_deduction "${Intel15_CXX14}")
+set(_cmake_feature_test_cxx_return_type_deduction "__cpp_return_type_deduction >= 201304 || ${Intel15_CXX14}")
+unset(Intel15_CXX14)
+unset(Intel15)
set(Intel15_CXX11 "__INTEL_COMPILER >= 1500 && ${DETECT_CXX11}")
set(_cmake_feature_test_cxx_alignas "${Intel15_CXX11}")
set(_cmake_feature_test_cxx_alignof "${Intel15_CXX11}")
set(_cmake_feature_test_cxx_inheriting_constructors "${Intel15_CXX11}")
-set(_cmake_feature_test_cxx_user_literals "${Intel15_CXX11}")
+set(_cmake_feature_test_cxx_user_literals "__cpp_user_defined_literals >= 200809 || (${Intel15_CXX11} && (!defined(_MSC_VER) || __INTEL_COMPILER >= 1600))")
set(_cmake_feature_test_cxx_thread_local "${Intel15_CXX11}")
+unset(Intel15_CXX11)
set(Intel14_CXX11 "${DETECT_CXX11} && (__INTEL_COMPILER > 1400 || (__INTEL_COMPILER == 1400 && __INTEL_COMPILER_UPDATE >= 2))")
# Documented as 12.0+ but in testing it only works on 14.0.2+
-set(_cmake_feature_test_cxx_decltype_incomplete_return_types "${Intel14_CXX11}")
+set(_cmake_feature_test_cxx_decltype_incomplete_return_types "${Intel14_CXX11} && !defined(_MSC_VER)")
set(Intel14_CXX11 "__INTEL_COMPILER >= 1400 && ${DETECT_CXX11}")
set(_cmake_feature_test_cxx_delegating_constructors "${Intel14_CXX11}")
-set(_cmake_feature_test_cxx_constexpr "${Intel14_CXX11}")
+set(_cmake_feature_test_cxx_constexpr "__cpp_constexpr >= 200704 || ${Intel14_CXX11}")
set(_cmake_feature_test_cxx_sizeof_member "${Intel14_CXX11}")
set(_cmake_feature_test_cxx_strong_enums "${Intel14_CXX11}")
set(_cmake_feature_test_cxx_reference_qualified_functions "${Intel14_CXX11}")
-set(_cmake_feature_test_cxx_raw_string_literals "${Intel14_CXX11}")
-set(_cmake_feature_test_cxx_unicode_literals "${Intel14_CXX11}")
+set(_cmake_feature_test_cxx_raw_string_literals "__cpp_raw_strings >= 200710 || ${Intel14_CXX11}")
+set(_cmake_feature_test_cxx_unicode_literals "__cpp_unicode_literals >= 200710 || (${Intel14_CXX11} && (!defined(_MSC_VER) || __INTEL_COMPILER >= 1600))")
set(_cmake_feature_test_cxx_inline_namespaces "${Intel14_CXX11}")
set(_cmake_feature_test_cxx_unrestricted_unions "${Intel14_CXX11}")
set(_cmake_feature_test_cxx_nonstatic_member_init "${Intel14_CXX11}")
@@ -64,29 +73,32 @@ set(_cmake_feature_test_cxx_override "${Intel14_CXX11}")
set(_cmake_feature_test_cxx_final "${Intel14_CXX11}")
set(_cmake_feature_test_cxx_noexcept "${Intel14_CXX11}")
set(_cmake_feature_test_cxx_defaulted_move_initializers "${Intel14_CXX11}")
+unset(Intel14_CXX11)
set(Intel13_CXX11 "__INTEL_COMPILER >= 1300 && ${DETECT_CXX11}")
set(_cmake_feature_test_cxx_explicit_conversions "${Intel13_CXX11}")
set(_cmake_feature_test_cxx_range_for "${Intel13_CXX11}")
# Cannot find Intel documentation for N2640: cxx_uniform_initialization
set(_cmake_feature_test_cxx_uniform_initialization "${Intel13_CXX11}")
+unset(Intel13_CXX11)
-set(Intel121_CXX11 "${_cmake_oldestSupported} && ${DETECT_CXX11}")
-set(_cmake_feature_test_cxx_variadic_templates "${Intel121_CXX11}")
+set(Intel121 "${_cmake_oldestSupported}")
+set(Intel121_CXX11 "${Intel121} && ${DETECT_CXX11}")
+set(_cmake_feature_test_cxx_variadic_templates "(__cpp_variadic_templates >= 200704 || ${Intel121}) && ${DETECT_CXX11}") # [1]
set(_cmake_feature_test_cxx_alias_templates "${Intel121_CXX11}")
set(_cmake_feature_test_cxx_nullptr "${Intel121_CXX11}")
set(_cmake_feature_test_cxx_trailing_return_types "${Intel121_CXX11}")
-set(_cmake_feature_test_cxx_attributes "${Intel121_CXX11}")
+set(_cmake_feature_test_cxx_attributes "(__cpp_attributes >= 200809 || ${Intel121}) && ${DETECT_CXX11}") # [1]
set(_cmake_feature_test_cxx_default_function_template_args "${Intel121_CXX11}")
set(_cmake_feature_test_cxx_extended_friend_declarations "${Intel121_CXX11}")
-set(_cmake_feature_test_cxx_rvalue_references "${Intel121_CXX11}")
-set(_cmake_feature_test_cxx_decltype "${Intel121_CXX11}")
+set(_cmake_feature_test_cxx_rvalue_references "(__cpp_rvalue_references >= 200610 || ${Intel121}) && ${DETECT_CXX11}") # [1]
+set(_cmake_feature_test_cxx_decltype "__cpp_decltype >= 200707 || ${Intel121_CXX11}")
set(_cmake_feature_test_cxx_defaulted_functions "${Intel121_CXX11}")
set(_cmake_feature_test_cxx_deleted_functions "${Intel121_CXX11}")
set(_cmake_feature_test_cxx_local_type_template_args "${Intel121_CXX11}")
-set(_cmake_feature_test_cxx_lambdas "${Intel121_CXX11}")
-set(_cmake_feature_test_cxx_binary_literals "${Intel121_CXX11}")
-set(_cmake_feature_test_cxx_static_assert "${Intel121_CXX11}")
+set(_cmake_feature_test_cxx_lambdas "(__cpp_lambdas >= 200907 || ${Intel121}) && ${DETECT_CXX11}") # [1]
+set(_cmake_feature_test_cxx_binary_literals "__cpp_binary_literals >= 201304 || ${Intel121}")
+set(_cmake_feature_test_cxx_static_assert "(__cpp_static_assert >= 200410 || ${Intel121}) && ${DETECT_CXX11}")
set(_cmake_feature_test_cxx_right_angle_brackets "${Intel121_CXX11}")
set(_cmake_feature_test_cxx_auto_type "${Intel121_CXX11}")
set(_cmake_feature_test_cxx_extern_templates "${Intel121_CXX11}")
@@ -94,3 +106,8 @@ set(_cmake_feature_test_cxx_variadic_macros "${Intel121_CXX11}")
set(_cmake_feature_test_cxx_long_long_type "${Intel121_CXX11}")
set(_cmake_feature_test_cxx_func_identifier "${Intel121_CXX11}")
set(_cmake_feature_test_cxx_template_template_parameters "${Intel121_CXX11}")
+unset(Intel121_CXX11)
+unset(Intel121)
+
+unset(DETECT_CXX11)
+unset(DETECT_CXX14)
diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake
index 73dd7fa..9c39236 100644
--- a/Modules/Compiler/Intel-CXX.cmake
+++ b/Modules/Compiler/Intel-CXX.cmake
@@ -10,19 +10,23 @@ set(CMAKE_DEPFILE_FLAGS_CXX "-MD -MT <OBJECT> -MF <DEPFILE>")
if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
set(_std -Qstd)
set(_ext c++)
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0)
+ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-Qstd=c++14")
+ # todo: there is no gnu++14 value supported; figure out what to do
+ set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-Qstd=c++14")
+ endif()
else()
set(_std -std)
set(_ext gnu++)
-endif()
-
-if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.2)
- set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "${_std}=c++14")
- # todo: there is no gnu++14 value supported; figure out what to do
- set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "${_std}=c++14")
-elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.0)
- set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "${_std}=c++1y")
- # todo: there is no gnu++14 value supported; figure out what to do
- set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "${_std}=c++1y")
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.2)
+ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
+ # todo: there is no gnu++14 value supported; figure out what to do
+ set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=c++14")
+ elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.0)
+ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
+ # todo: there is no gnu++14 value supported; figure out what to do
+ set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=c++1y")
+ endif()
endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0)
@@ -34,8 +38,13 @@ elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
- set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "${_std}=c++98")
- set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "${_std}=${_ext}98")
+ if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "")
+ else()
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "${_std}=c++98")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "${_std}=gnu++98")
+ endif()
endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
@@ -55,21 +64,19 @@ unset(_std)
unset(_ext)
macro(cmake_record_cxx_compile_features)
- macro(_get_intel_features std_version list)
- record_compiler_features(CXX "${std_version}" ${list})
- endmacro()
-
set(_result 0)
- if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC" AND
- NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0)
- _get_intel_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES)
+ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
+ if (_result EQUAL 0 AND
+ (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0
+ OR (NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC" AND
+ NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0)))
+ _record_compiler_features_cxx(14)
endif()
if (_result EQUAL 0)
- _get_intel_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES)
+ _record_compiler_features_cxx(11)
endif()
if (_result EQUAL 0)
- _get_intel_features(${CMAKE_CXX98_STANDARD_COMPILE_OPTION} CMAKE_CXX98_COMPILE_FEATURES)
+ _record_compiler_features_cxx(98)
endif()
endif()
endmacro()
diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake
index 82ce069..8fcfa0f 100644
--- a/Modules/Compiler/MSVC-CXX.cmake
+++ b/Modules/Compiler/MSVC-CXX.cmake
@@ -5,5 +5,13 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0)
endif()
macro(cmake_record_cxx_compile_features)
- record_compiler_features(CXX "" CMAKE_CXX_COMPILE_FEATURES)
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0)
+ list(APPEND CMAKE_CXX_COMPILE_FEATURES
+ cxx_std_98
+ cxx_std_11
+ cxx_std_14
+ cxx_std_17
+ )
+ _record_compiler_features(CXX "" CMAKE_CXX_COMPILE_FEATURES)
+ endif()
endmacro()
diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake
new file mode 100644
index 0000000..316cab8
--- /dev/null
+++ b/Modules/Compiler/NVIDIA-CUDA.cmake
@@ -0,0 +1,27 @@
+set(CMAKE_CUDA_VERBOSE_FLAG "-v")
+
+if(NOT "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC")
+ set(CMAKE_CUDA_COMPILE_OPTIONS_PIE -Xcompiler=-fPIE)
+ set(CMAKE_CUDA_COMPILE_OPTIONS_PIC -Xcompiler=-fPIC)
+ set(CMAKE_CUDA_COMPILE_OPTIONS_VISIBILITY -Xcompiler=-fvisibility=)
+ # CMAKE_SHARED_LIBRARY_CUDA_FLAGS is sent to the host linker so we
+ # don't need to forward it through nvcc.
+ set(CMAKE_SHARED_LIBRARY_CUDA_FLAGS -fPIC)
+ string(APPEND CMAKE_CUDA_FLAGS_INIT " ")
+ string(APPEND CMAKE_CUDA_FLAGS_DEBUG_INIT " -g")
+ string(APPEND CMAKE_CUDA_FLAGS_RELEASE_INIT " -O3 -DNDEBUG")
+ string(APPEND CMAKE_CUDA_FLAGS_MINSIZEREL_INIT " -O1 -DNDEBUG")
+ string(APPEND CMAKE_CUDA_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG")
+endif()
+set(CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS -shared)
+set(CMAKE_INCLUDE_SYSTEM_FLAG_CUDA -isystem=)
+
+if("x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC")
+ set(CMAKE_CUDA_STANDARD_DEFAULT "")
+else()
+ set(CMAKE_CUDA_STANDARD_DEFAULT 98)
+ set(CMAKE_CUDA98_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CUDA98_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_CUDA11_STANDARD_COMPILE_OPTION "-std=c++11")
+ set(CMAKE_CUDA11_EXTENSION_COMPILE_OPTION "-std=c++11")
+endif()
diff --git a/Modules/Compiler/NVIDIA-DetermineCompiler.cmake b/Modules/Compiler/NVIDIA-DetermineCompiler.cmake
new file mode 100644
index 0000000..cb0beaf
--- /dev/null
+++ b/Modules/Compiler/NVIDIA-DetermineCompiler.cmake
@@ -0,0 +1,17 @@
+
+set(_compiler_id_pp_test "defined(__NVCC__)")
+
+set(_compiler_id_version_compute "
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__CUDACC_VER_MAJOR__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__CUDACC_VER_MINOR__)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__CUDACC_VER_BUILD__)
+# if defined(_MSC_VER)
+ /* _MSC_VER = VVRR */
+# define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(_MSC_VER / 100)
+# define @PREFIX@SIMULATE_VERSION_MINOR @MACRO_DEC@(_MSC_VER % 100)
+# endif")
+
+set(_compiler_id_simulate "
+# if defined(_MSC_VER)
+# define @PREFIX@SIMULATE_ID \"MSVC\"
+# endif")
diff --git a/Modules/Compiler/PGI-Fortran.cmake b/Modules/Compiler/PGI-Fortran.cmake
index 3765079..4783424 100644
--- a/Modules/Compiler/PGI-Fortran.cmake
+++ b/Modules/Compiler/PGI-Fortran.cmake
@@ -1,6 +1,9 @@
include(Compiler/PGI)
__compiler_pgi(Fortran)
+set(CMAKE_Fortran_PREPROCESS_SOURCE
+ "<CMAKE_Fortran_COMPILER> -Mpreprocess <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-Mnofreeform")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-Mfreeform")
diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake
index ce01cdd..f4345b8 100644
--- a/Modules/Compiler/SunPro-CXX.cmake
+++ b/Modules/Compiler/SunPro-CXX.cmake
@@ -32,6 +32,8 @@ set(CMAKE_CXX_CREATE_STATIC_LIBRARY
"<CMAKE_RANLIB> <TARGET> ")
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "")
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=c++11")
endif()
@@ -49,15 +51,13 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
endif()
macro(cmake_record_cxx_compile_features)
- macro(_get_solaris_studio_features std_version list)
- record_compiler_features(CXX "${std_version}" ${list})
- endmacro()
-
set(_result 0)
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
- _get_solaris_studio_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES)
if (_result EQUAL 0)
- _get_solaris_studio_features("" CMAKE_CXX98_COMPILE_FEATURES)
+ _record_compiler_features_cxx(11)
+ endif()
+ if (_result EQUAL 0)
+ _record_compiler_features_cxx(98)
endif()
endif()
endmacro()
diff --git a/Modules/CompilerId/VS-10.csproj.in b/Modules/CompilerId/VS-10.csproj.in
new file mode 100644
index 0000000..ed5e847
--- /dev/null
+++ b/Modules/CompilerId/VS-10.csproj.in
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{CAE07175-D007-4FC3-BFE8-47B392814159}</ProjectGuid>
+ <RootNamespace>CompilerId@id_lang@</RootNamespace>
+ <Keyword>Win32Proj</Keyword>
+ @id_system@
+ @id_system_version@
+ @id_WindowsTargetPlatformVersion@
+ @id_WindowsSDKDesktopARMSupport@
+ </PropertyGroup>
+ <PropertyGroup>
+ @id_PreferredToolArchitecture@
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ @id_toolset@
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <!-- ============================================================ -->
+ <!-- == set preprocessor definitions == -->
+ <!-- ============================================================ -->
+ <PropertyGroup>
+ <DefineConstants></DefineConstants>
+ <UnknownValue>Unknown</UnknownValue>
+ </PropertyGroup>
+ <!-- Platform -->
+ <PropertyGroup Condition="'$(Platform)'!=''">
+ <DefineConstants>$(DefineConstants);Platform$(Platform)</DefineConstants>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Platform)'==''">
+ <DefineConstants>$(DefineConstants);Platform$(UnknownValue)</DefineConstants>
+ </PropertyGroup>
+ <!-- PlatformToolset -->
+ <PropertyGroup Condition="'$(PlatformToolset)'!=''">
+ <DefineConstants>$(DefineConstants);PlatformToolset$(PlatformToolset)</DefineConstants>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(PlatformToolset)'==''">
+ <DefineConstants>$(DefineConstants);PlatformToolset$(UnknownValue)</DefineConstants>
+ </PropertyGroup>
+ <!-- ============================================================ -->
+ <PropertyGroup>
+ <OutputPath Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'">.\</OutputPath>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="@id_src@" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <PropertyGroup>
+ <PostBuildEvent>if not "$(RoslynTargetsPath)"=="" if exist "$(RoslynTargetsPath)\@id_cl@" set _CSC=$(RoslynTargetsPath)
+if exist "$(MSBuildToolsPath)\@id_cl@" set _CSC=$(MSBuildToolsPath)
+if "%_CSC%"=="" exit -1
+%40echo CMAKE_@id_lang@_COMPILER=%_CSC%\@id_cl@</PostBuildEvent>
+ </PropertyGroup>
+</Project>
diff --git a/Modules/CompilerId/VS-10.vcxproj.in b/Modules/CompilerId/VS-10.vcxproj.in
index 2870a11..50be9cb 100644
--- a/Modules/CompilerId/VS-10.vcxproj.in
+++ b/Modules/CompilerId/VS-10.vcxproj.in
@@ -16,6 +16,9 @@
@id_WindowsSDKDesktopARMSupport@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup>
+ @id_PreferredToolArchitecture@
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
@id_toolset@
diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake
index b00de14..873f88d 100644
--- a/Modules/ExternalData.cmake
+++ b/Modules/ExternalData.cmake
@@ -201,6 +201,11 @@ For example, the argument ``DATA{img.png}`` may be satisfied by either a
real ``img.png`` file in the current source directory or a ``img.png.md5``
file containing its MD5 sum.
+Multiple content links of the same name with different hash algorithms
+are supported (e.g. ``img.png.sha256`` and ``img.png.sha1``) so long as
+they all correspond to the same real file. This allows objects to be
+fetched from sources indexed by different hash algorithms.
+
Referencing File Series
"""""""""""""""""""""""
@@ -274,6 +279,10 @@ The following hash algorithms are supported::
SHA256 .sha256 US Secure Hash Algorithms, RFC 4634
SHA384 .sha384 US Secure Hash Algorithms, RFC 4634
SHA512 .sha512 US Secure Hash Algorithms, RFC 4634
+ SHA3_224 .sha3-224 Keccak SHA-3
+ SHA3_256 .sha3-256 Keccak SHA-3
+ SHA3_384 .sha3-384 Keccak SHA-3
+ SHA3_512 .sha3-512 Keccak SHA-3
Note that the hashes are used only for unique data identification and
download verification.
@@ -429,8 +438,10 @@ function(ExternalData_add_target target)
string(REPLACE "|" ";" tuple "${entry}")
list(GET tuple 0 file)
list(GET tuple 1 name)
- list(GET tuple 2 ext)
- set(stamp "${ext}-stamp")
+ list(GET tuple 2 exts)
+ string(REPLACE "+" ";" exts_list "${exts}")
+ list(GET exts_list 0 first_ext)
+ set(stamp "-hash-stamp")
if(NOT DEFINED "_ExternalData_FILE_${file}")
set("_ExternalData_FILE_${file}" 1)
get_property(added DIRECTORY PROPERTY "_ExternalData_FILE_${file}")
@@ -446,12 +457,12 @@ function(ExternalData_add_target target)
OUTPUT "${file}${stamp}" "${file}"
# Run the data fetch/update script.
COMMAND ${CMAKE_COMMAND} -Drelative_top=${CMAKE_BINARY_DIR}
- -Dfile=${file} -Dname=${name} -Dext=${ext}
+ -Dfile=${file} -Dname=${name} -Dexts=${exts}
-DExternalData_ACTION=fetch
-DExternalData_CONFIG=${config}
-P ${_ExternalData_SELF}
# Update whenever the object hash changes.
- MAIN_DEPENDENCY "${name}${ext}"
+ MAIN_DEPENDENCY "${name}${first_ext}"
)
endif()
list(APPEND files "${file}${stamp}")
@@ -501,8 +512,8 @@ endfunction()
#-----------------------------------------------------------------------------
# Private helper interface
-set(_ExternalData_REGEX_ALGO "MD5|SHA1|SHA224|SHA256|SHA384|SHA512")
-set(_ExternalData_REGEX_EXT "md5|sha1|sha224|sha256|sha384|sha512")
+set(_ExternalData_REGEX_ALGO "MD5|SHA1|SHA224|SHA256|SHA384|SHA512|SHA3_224|SHA3_256|SHA3_384|SHA3_512")
+set(_ExternalData_REGEX_EXT "md5|sha1|sha224|sha256|sha384|sha512|sha3-224|sha3-256|sha3-384|sha3-512")
set(_ExternalData_SELF "${CMAKE_CURRENT_LIST_FILE}")
get_filename_component(_ExternalData_SELF_DIR "${_ExternalData_SELF}" PATH)
@@ -798,6 +809,7 @@ function(_ExternalData_arg_find_files glob pattern regex)
cmake_policy(SET CMP0009 NEW)
file(${glob} globbed RELATIVE "${top_src}" "${top_src}/${pattern}*")
cmake_policy(POP)
+ set(externals_count -1)
foreach(entry IN LISTS globbed)
if("x${entry}" MATCHES "^x(.*)(\\.(${_ExternalData_REGEX_EXT}))$")
set(relname "${CMAKE_MATCH_1}")
@@ -817,7 +829,11 @@ function(_ExternalData_arg_find_files glob pattern regex)
set(name "${top_src}/${relname}")
set(file "${top_bin}/${relname}")
if(alg)
- list(APPEND external "${file}|${name}|${alg}")
+ if(NOT "${external_${externals_count}_file_name}" STREQUAL "${file}|${name}")
+ math(EXPR externals_count "${externals_count} + 1")
+ set(external_${externals_count}_file_name "${file}|${name}")
+ endif()
+ list(APPEND external_${externals_count}_algs "${alg}")
elseif(ExternalData_LINK_CONTENT)
_ExternalData_link_content("${name}" alg)
list(APPEND external "${file}|${name}|${alg}")
@@ -830,6 +846,14 @@ function(_ExternalData_arg_find_files glob pattern regex)
endif()
endif()
endforeach()
+ if(${externals_count} GREATER -1)
+ foreach(ii RANGE ${externals_count})
+ string(REPLACE ";" "+" algs_delim "${external_${ii}_algs}")
+ list(APPEND external "${external_${ii}_file_name}|${algs_delim}")
+ unset(external_${ii}_algs)
+ unset(external_${ii}_file_name)
+ endforeach()
+ endif()
set(external "${external}" PARENT_SCOPE)
set(internal "${internal}" PARENT_SCOPE)
set(have_original "${have_original}" PARENT_SCOPE)
@@ -947,13 +971,28 @@ function(_ExternalData_custom_fetch key loc file err_var msg_var)
set("${msg_var}" "${msg}" PARENT_SCOPE)
endfunction()
-function(_ExternalData_download_object name hash algo var_obj)
+function(_ExternalData_get_from_object_store hash algo var_obj var_success)
+ # Search all object stores for an existing object.
+ foreach(dir ${ExternalData_OBJECT_STORES})
+ set(obj "${dir}/${algo}/${hash}")
+ if(EXISTS "${obj}")
+ message(STATUS "Found object: \"${obj}\"")
+ set("${var_obj}" "${obj}" PARENT_SCOPE)
+ set("${var_success}" 1 PARENT_SCOPE)
+ return()
+ endif()
+ endforeach()
+endfunction()
+
+function(_ExternalData_download_object name hash algo var_obj var_success var_errorMsg)
# Search all object stores for an existing object.
+ set(success 1)
foreach(dir ${ExternalData_OBJECT_STORES})
set(obj "${dir}/${algo}/${hash}")
if(EXISTS "${obj}")
message(STATUS "Found object: \"${obj}\"")
set("${var_obj}" "${obj}" PARENT_SCOPE)
+ set("${var_success}" "${success}" PARENT_SCOPE)
return()
endif()
endforeach()
@@ -1008,6 +1047,7 @@ function(_ExternalData_download_object name hash algo var_obj)
get_filename_component(dir "${name}" PATH)
set(staged "${dir}/.ExternalData_${algo}_${hash}")
+ set(success 1)
if(found)
file(RENAME "${tmp}" "${obj}")
message(STATUS "Downloaded object: \"${obj}\"")
@@ -1018,38 +1058,75 @@ function(_ExternalData_download_object name hash algo var_obj)
if(NOT tried)
set(tried "\n (No ExternalData_URL_TEMPLATES given)")
endif()
- message(FATAL_ERROR "Object ${algo}=${hash} not found at:${tried}")
+ set(success 0)
+ set("${var_errorMsg}" "Object ${algo}=${hash} not found at:${tried}" PARENT_SCOPE)
endif()
set("${var_obj}" "${obj}" PARENT_SCOPE)
+ set("${var_success}" "${success}" PARENT_SCOPE)
endfunction()
if("${ExternalData_ACTION}" STREQUAL "fetch")
- foreach(v ExternalData_OBJECT_STORES file name ext)
+ foreach(v ExternalData_OBJECT_STORES file name exts)
if(NOT DEFINED "${v}")
message(FATAL_ERROR "No \"-D${v}=\" value provided!")
endif()
endforeach()
- file(READ "${name}${ext}" hash)
- string(STRIP "${hash}" hash)
-
- if("${ext}" MATCHES "^\\.(${_ExternalData_REGEX_EXT})$")
- string(TOUPPER "${CMAKE_MATCH_1}" algo)
- else()
- message(FATAL_ERROR "Unknown hash algorithm extension \"${ext}\"")
- endif()
+ string(REPLACE "+" ";" exts_list "${exts}")
+ set(succeeded 0)
+ set(errorMsg "")
+ set(hash_list )
+ set(algo_list )
+ set(hash )
+ set(algo )
+ foreach(ext ${exts_list})
+ file(READ "${name}${ext}" hash)
+ string(STRIP "${hash}" hash)
+
+ if("${ext}" MATCHES "^\\.(${_ExternalData_REGEX_EXT})$")
+ string(TOUPPER "${CMAKE_MATCH_1}" algo)
+ string(REPLACE "-" "_" algo "${algo}")
+ else()
+ message(FATAL_ERROR "Unknown hash algorithm extension \"${ext}\"")
+ endif()
- _ExternalData_download_object("${name}" "${hash}" "${algo}" obj)
+ list(APPEND hash_list ${hash})
+ list(APPEND algo_list ${algo})
+ endforeach()
+ list(LENGTH exts_list num_extensions)
+ math(EXPR exts_range "${num_extensions} - 1")
+ foreach(ii RANGE 0 ${exts_range})
+ list(GET hash_list ${ii} hash)
+ list(GET algo_list ${ii} algo)
+ _ExternalData_get_from_object_store("${hash}" "${algo}" obj succeeded)
+ if(succeeded)
+ break()
+ endif()
+ endforeach()
+ if(NOT succeeded)
+ foreach(ii RANGE 0 ${exts_range})
+ list(GET hash_list ${ii} hash)
+ list(GET algo_list ${ii} algo)
+ _ExternalData_download_object("${name}" "${hash}" "${algo}"
+ obj succeeded algoErrorMsg)
+ set(errorMsg "${errorMsg}\n${algoErrorMsg}")
+ if(succeeded)
+ break()
+ endif()
+ endforeach()
+ endif()
+ if(NOT succeeded)
+ message(FATAL_ERROR "${errorMsg}")
+ endif()
# Check if file already corresponds to the object.
- set(stamp "${ext}-stamp")
+ set(stamp "-hash-stamp")
set(file_up_to_date 0)
if(EXISTS "${file}" AND EXISTS "${file}${stamp}")
file(READ "${file}${stamp}" f_hash)
string(STRIP "${f_hash}" f_hash)
if("${f_hash}" STREQUAL "${hash}")
- #message(STATUS "File already corresponds to object")
set(file_up_to_date 1)
endif()
endif()
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 4551cc8..00781d6 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -65,9 +65,18 @@ Create custom targets to build projects in external trees
``GIT_SUBMODULES <module>...``
Git submodules that shall be updated, all if empty
``GIT_SHALLOW 1``
- Tell Git to clone with ``--depth 1``. Use when ``GIT_TAG`` is not
+ Tell Git to clone with ``--depth 1``. Use when ``GIT_TAG`` is not
specified or when it names a branch in order to download only the
tip of the branch without the rest of its history.
+ ``GIT_PROGRESS 1``
+ Tell Git to clone with ``--progress``. For large projects, the clone step
+ does not output anything which can make the build appear to have stalled.
+ This option forces Git to output progress information during the clone step
+ so that forward progress is indicated.
+ ``GIT_CONFIG <option>...``
+ Tell Git to clone with ``--config <option>``. Use additional configuration
+ parameters when cloning the project (``key=value`` as expected by ``git
+ config``).
``HG_REPOSITORY <url>``
URL of mercurial repo
``HG_TAG <tag>``
@@ -165,9 +174,16 @@ Create custom targets to build projects in external trees
Install step options are:
``INSTALL_DIR <dir>``
- Installation prefix
+ Installation prefix to be placed in the ``<INSTALL_DIR>`` placeholder.
+ This does not actually configure the external project to install to
+ the given prefix. That must be done by passing appropriate arguments
+ to the external project configuration step, e.g. using ``<INSTALL_DIR>``.
``INSTALL_COMMAND <cmd>...``
- Command to drive install after build
+ Command to drive installation of the external project after it has been
+ built. This only happens at the *build* time of the calling project.
+ In order to install files from the external project alongside the
+ locally-built files, a separate local :command:`install` call must be
+ added to pick the files up from one of the external project trees.
Test step options are:
@@ -418,7 +434,7 @@ if(_ep_func)
endif()
# Save regex matching supported hash algorithm names.
-set(_ep_hash_algos "MD5|SHA1|SHA224|SHA256|SHA384|SHA512")
+set(_ep_hash_algos "MD5|SHA1|SHA224|SHA256|SHA384|SHA512|SHA3_224|SHA3_256|SHA3_384|SHA3_512")
set(_ep_hash_regex "^(${_ep_hash_algos})=([0-9A-Fa-f]+)$")
set(_ExternalProject_SELF "${CMAKE_CURRENT_LIST_FILE}")
@@ -509,7 +525,7 @@ define_property(DIRECTORY PROPERTY "EP_UPDATE_DISCONNECTED" INHERITED
"ExternalProject module."
)
-function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag git_remote_name git_submodules git_shallow src_name work_dir gitclone_infofile gitclone_stampfile tls_verify)
+function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag git_remote_name git_submodules git_shallow git_progress git_config src_name work_dir gitclone_infofile gitclone_stampfile tls_verify)
if(NOT GIT_VERSION_STRING VERSION_LESS 1.7.10)
set(git_clone_shallow_options "--depth 1 --no-single-branch")
else()
@@ -555,6 +571,16 @@ if(git_shallow)
list(APPEND git_clone_options ${git_clone_shallow_options})
endif()
+set(git_progress \"${git_progress}\")
+if(git_progress)
+ list(APPEND git_clone_options --progress)
+endif()
+
+set(git_config \"${git_config}\")
+foreach(config IN LISTS git_config)
+ list(APPEND git_clone_options --config \${config})
+endforeach()
+
# try the clone 3 times incase there is an odd git clone issue
set(error_code 1)
set(number_of_tries 0)
@@ -575,7 +601,7 @@ if(error_code)
endif()
execute_process(
- COMMAND \"${git_EXECUTABLE}\" \${git_options} checkout ${git_tag}
+ COMMAND \"${git_EXECUTABLE}\" \${git_options} checkout ${git_tag} --
WORKING_DIRECTORY \"${work_dir}/${src_name}\"
RESULT_VARIABLE error_code
)
@@ -870,7 +896,7 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_p
if("${hash}" MATCHES "${_ep_hash_regex}")
set(ALGO "${CMAKE_MATCH_1}")
- set(EXPECT_VALUE "${CMAKE_MATCH_2}")
+ string(TOLOWER "${CMAKE_MATCH_2}" EXPECT_VALUE)
else()
set(ALGO "")
set(EXPECT_VALUE "")
@@ -1180,6 +1206,7 @@ function(_ep_write_initial_cache target_name script_filename script_initial_cach
# Write out values into an initial cache, that will be passed to CMake with -C
# Replace location tags.
_ep_replace_location_tags(${target_name} script_initial_cache)
+ _ep_replace_location_tags(${target_name} script_filename)
# Write out the initial cache file to the location specified.
file(GENERATE OUTPUT "${script_filename}" CONTENT "${script_initial_cache}")
endfunction()
@@ -1225,87 +1252,84 @@ endfunction()
function(_ep_get_build_command name step cmd_var)
- set(cmd "${${cmd_var}}")
- if(NOT cmd)
- set(args)
- _ep_get_configure_command_id(${name} cfg_cmd_id)
- if(cfg_cmd_id STREQUAL "cmake")
- # CMake project. Select build command based on generator.
- get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR)
- if("${CMAKE_GENERATOR}" MATCHES "Make" AND
- ("${cmake_generator}" MATCHES "Make" OR NOT cmake_generator))
- # The project uses the same Makefile generator. Use recursive make.
- set(cmd "$(MAKE)")
- if(step STREQUAL "INSTALL")
- set(args install)
- endif()
- if("x${step}x" STREQUAL "xTESTx")
- set(args test)
- endif()
- else()
- # Drive the project with "cmake --build".
- get_target_property(cmake_command ${name} _EP_CMAKE_COMMAND)
- if(cmake_command)
- set(cmd "${cmake_command}")
- else()
- set(cmd "${CMAKE_COMMAND}")
- endif()
- set(args --build ".")
- if(CMAKE_CONFIGURATION_TYPES)
- if (CMAKE_CFG_INTDIR AND
- NOT CMAKE_CFG_INTDIR STREQUAL "." AND
- NOT CMAKE_CFG_INTDIR MATCHES "\\$")
- # CMake 3.4 and below used the CMAKE_CFG_INTDIR placeholder value
- # provided by multi-configuration generators. Some projects were
- # taking advantage of that undocumented implementation detail to
- # specify a specific configuration here. They should use
- # BUILD_COMMAND to change the default command instead, but for
- # compatibility honor the value.
- set(config ${CMAKE_CFG_INTDIR})
- message(AUTHOR_WARNING "CMAKE_CFG_INTDIR should not be set by project code.\n"
- "To get a non-default build command, use the BUILD_COMMAND option.")
- else()
- set(config $<CONFIG>)
- endif()
- list(APPEND args --config ${config})
- endif()
- if(step STREQUAL "INSTALL")
- list(APPEND args --target install)
- endif()
- # But for "TEST" drive the project with corresponding "ctest".
- if("x${step}x" STREQUAL "xTESTx")
- string(REGEX REPLACE "^(.*/)cmake([^/]*)$" "\\1ctest\\2" cmd "${cmd}")
- set(args "")
- if(CMAKE_CONFIGURATION_TYPES)
- list(APPEND args -C ${config})
- endif()
- endif()
+ set(cmd "")
+ set(args)
+ _ep_get_configure_command_id(${name} cfg_cmd_id)
+ if(cfg_cmd_id STREQUAL "cmake")
+ # CMake project. Select build command based on generator.
+ get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR)
+ if("${CMAKE_GENERATOR}" MATCHES "Make" AND
+ ("${cmake_generator}" MATCHES "Make" OR NOT cmake_generator))
+ # The project uses the same Makefile generator. Use recursive make.
+ set(cmd "$(MAKE)")
+ if(step STREQUAL "INSTALL")
+ set(args install)
+ endif()
+ if("x${step}x" STREQUAL "xTESTx")
+ set(args test)
endif()
else()
- # Non-CMake project. Guess "make" and "make install" and "make test".
- if("${CMAKE_GENERATOR}" MATCHES "Makefiles")
- # Try to get the parallel arguments
- set(cmd "$(MAKE)")
+ # Drive the project with "cmake --build".
+ get_target_property(cmake_command ${name} _EP_CMAKE_COMMAND)
+ if(cmake_command)
+ set(cmd "${cmake_command}")
else()
- set(cmd "make")
+ set(cmd "${CMAKE_COMMAND}")
+ endif()
+ set(args --build ".")
+ if(CMAKE_CONFIGURATION_TYPES)
+ if (CMAKE_CFG_INTDIR AND
+ NOT CMAKE_CFG_INTDIR STREQUAL "." AND
+ NOT CMAKE_CFG_INTDIR MATCHES "\\$")
+ # CMake 3.4 and below used the CMAKE_CFG_INTDIR placeholder value
+ # provided by multi-configuration generators. Some projects were
+ # taking advantage of that undocumented implementation detail to
+ # specify a specific configuration here. They should use
+ # BUILD_COMMAND to change the default command instead, but for
+ # compatibility honor the value.
+ set(config ${CMAKE_CFG_INTDIR})
+ message(AUTHOR_WARNING "CMAKE_CFG_INTDIR should not be set by project code.\n"
+ "To get a non-default build command, use the BUILD_COMMAND option.")
+ else()
+ set(config $<CONFIG>)
+ endif()
+ list(APPEND args --config ${config})
endif()
if(step STREQUAL "INSTALL")
- set(args install)
+ list(APPEND args --target install)
endif()
+ # But for "TEST" drive the project with corresponding "ctest".
if("x${step}x" STREQUAL "xTESTx")
- set(args test)
+ string(REGEX REPLACE "^(.*/)cmake([^/]*)$" "\\1ctest\\2" cmd "${cmd}")
+ set(args "")
+ if(CMAKE_CONFIGURATION_TYPES)
+ list(APPEND args -C ${config})
+ endif()
endif()
endif()
-
- # Use user-specified arguments instead of default arguments, if any.
- get_property(have_args TARGET ${name} PROPERTY _EP_${step}_ARGS SET)
- if(have_args)
- get_target_property(args ${name} _EP_${step}_ARGS)
+ else()
+ # Non-CMake project. Guess "make" and "make install" and "make test".
+ if("${CMAKE_GENERATOR}" MATCHES "Makefiles")
+ # Try to get the parallel arguments
+ set(cmd "$(MAKE)")
+ else()
+ set(cmd "make")
endif()
+ if(step STREQUAL "INSTALL")
+ set(args install)
+ endif()
+ if("x${step}x" STREQUAL "xTESTx")
+ set(args test)
+ endif()
+ endif()
- list(APPEND cmd ${args})
+ # Use user-specified arguments instead of default arguments, if any.
+ get_property(have_args TARGET ${name} PROPERTY _EP_${step}_ARGS SET)
+ if(have_args)
+ get_target_property(args ${name} _EP_${step}_ARGS)
endif()
+ list(APPEND cmd ${args})
set(${cmd_var} "${cmd}" PARENT_SCOPE)
endfunction()
@@ -1800,6 +1824,8 @@ function(_ep_add_download_command name)
set(tls_verify "${CMAKE_TLS_VERIFY}")
endif()
get_property(git_shallow TARGET ${name} PROPERTY _EP_GIT_SHALLOW)
+ get_property(git_progress TARGET ${name} PROPERTY _EP_GIT_PROGRESS)
+ get_property(git_config TARGET ${name} PROPERTY _EP_GIT_CONFIG)
# For the download step, and the git clone operation, only the repository
# should be recorded in a configured RepositoryInfo file. If the repo
@@ -1824,7 +1850,7 @@ function(_ep_add_download_command name)
# The script will delete the source directory and then call git clone.
#
_ep_write_gitclone_script(${tmp_dir}/${name}-gitclone.cmake ${source_dir}
- ${GIT_EXECUTABLE} ${git_repository} ${git_tag} ${git_remote_name} "${git_submodules}" "${git_shallow}" ${src_name} ${work_dir}
+ ${GIT_EXECUTABLE} ${git_repository} ${git_tag} ${git_remote_name} "${git_submodules}" "${git_shallow}" "${git_progress}" "${git_config}" ${src_name} ${work_dir}
${stamp_dir}/${name}-gitinfo.txt ${stamp_dir}/${name}-gitclone-lastrun.txt "${tls_verify}"
)
set(comment "Performing download step (git clone) for '${name}'")
@@ -2143,12 +2169,12 @@ Update to Mercurial >= 2.1.1.
${uses_terminal}
)
- if(always AND update_disconnected)
+ if(update_disconnected)
_ep_get_step_stampfile(${name} skip-update skip-update_stamp_file)
string(REPLACE "Performing" "Skipping" comment "${comment}")
ExternalProject_Add_Step(${name} skip-update
COMMENT ${comment}
- ALWAYS 1
+ ALWAYS ${always}
EXCLUDE_FROM_MAIN 1
WORKING_DIRECTORY ${work_dir}
DEPENDEES download
@@ -2181,24 +2207,7 @@ function(_ep_add_patch_command name)
endfunction()
-# TODO: Make sure external projects use the proper compiler
-function(_ep_add_configure_command name)
- ExternalProject_Get_Property(${name} source_dir source_subdir binary_dir tmp_dir)
-
- # Depend on other external projects (file-level).
- set(file_deps)
- get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS)
- foreach(dep IN LISTS deps)
- get_property(dep_type TARGET ${dep} PROPERTY TYPE)
- if(dep_type STREQUAL "UTILITY")
- get_property(is_ep TARGET ${dep} PROPERTY _EP_IS_EXTERNAL_PROJECT)
- if(is_ep)
- _ep_get_step_stampfile(${dep} "done" done_stamp_file)
- list(APPEND file_deps ${done_stamp_file})
- endif()
- endif()
- endforeach()
-
+function(_ep_extract_configure_command var name)
get_property(cmd_set TARGET ${name} PROPERTY _EP_CONFIGURE_COMMAND SET)
if(cmd_set)
get_property(cmd TARGET ${name} PROPERTY _EP_CONFIGURE_COMMAND)
@@ -2219,7 +2228,7 @@ function(_ep_add_configure_command name)
get_property(cmake_cache_default_args TARGET ${name} PROPERTY _EP_CMAKE_CACHE_DEFAULT_ARGS)
if(cmake_cache_args OR cmake_cache_default_args)
- set(_ep_cache_args_script "${tmp_dir}/${name}-cache-$<CONFIG>.cmake")
+ set(_ep_cache_args_script "<TMP_DIR>/${name}-cache-$<CONFIG>.cmake")
if(cmake_cache_args)
_ep_command_line_to_initial_cache(script_initial_cache_force "${cmake_cache_args}" 1)
endif()
@@ -2261,9 +2270,32 @@ function(_ep_add_configure_command name)
endif()
endif()
- list(APPEND cmd "${source_dir}${source_subdir}")
+ list(APPEND cmd "<SOURCE_DIR><SOURCE_SUBDIR>")
endif()
+ set("${var}" "${cmd}" PARENT_SCOPE)
+endfunction()
+
+# TODO: Make sure external projects use the proper compiler
+function(_ep_add_configure_command name)
+ ExternalProject_Get_Property(${name} binary_dir tmp_dir)
+
+ # Depend on other external projects (file-level).
+ set(file_deps)
+ get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS)
+ foreach(dep IN LISTS deps)
+ get_property(dep_type TARGET ${dep} PROPERTY TYPE)
+ if(dep_type STREQUAL "UTILITY")
+ get_property(is_ep TARGET ${dep} PROPERTY _EP_IS_EXTERNAL_PROJECT)
+ if(is_ep)
+ _ep_get_step_stampfile(${dep} "done" done_stamp_file)
+ list(APPEND file_deps ${done_stamp_file})
+ endif()
+ endif()
+ endforeach()
+
+ _ep_extract_configure_command(cmd ${name})
+
# If anything about the configure command changes, (command itself, cmake
# used, cmake args or cmake generator) then re-run the configure step.
# Fixes issue https://gitlab.kitware.com/cmake/cmake/issues/10258
diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake
index 88bc1c8..f29a5f0 100644
--- a/Modules/FeatureSummary.cmake
+++ b/Modules/FeatureSummary.cmake
@@ -14,33 +14,93 @@ packages and/or feature for a build tree such as::
LibXml2 (required version >= 2.4), XML processing lib, <http://xmlsoft.org>
* Enables HTML-import in MyWordProcessor
* Enables odt-export in MyWordProcessor
- PNG , A PNG image library. , <http://www.libpng.org/pub/png/>
+ PNG, A PNG image library., <http://www.libpng.org/pub/png/>
* Enables saving screenshots
-- The following OPTIONAL packages have not been found:
- Lua51 , The Lua scripting language. , <http://www.lua.org>
+ Lua51, The Lua scripting language., <http://www.lua.org>
* Enables macros in MyWordProcessor
- Foo , Foo provides cool stuff.
+ Foo, Foo provides cool stuff.
+
+Global Properties
+^^^^^^^^^^^^^^^^^
+
+.. variable:: FeatureSummary_PKG_TYPES
+
+The global property :variable:`FeatureSummary_PKG_TYPES` defines the type of
+packages used by `FeatureSummary`.
+
+The order in this list is important, the first package type in the list is the
+least important, the last is the most important. the of a package can only be
+changed to higher types.
+
+The default package types are , ``RUNTIME``, ``OPTIONAL``, ``RECOMMENDED`` and
+``REQUIRED``, and their importance is
+``RUNTIME < OPTIONAL < RECOMMENDED < REQUIRED``.
+
+
+.. variable:: FeatureSummary_REQUIRED_PKG_TYPES
+
+The global property :variable:`FeatureSummary_REQUIRED_PKG_TYPES` defines which
+package types are required.
+
+If one or more package in this categories has not been found, CMake will abort
+when calling :command:`feature_summary` with the
+'FATAL_ON_MISSING_REQUIRED_PACKAGES' option enabled.
+
+The default value for this global property is ``REQUIRED``.
+
+
+.. variable:: FeatureSummary_DEFAULT_PKG_TYPE
+
+The global property :variable:`FeatureSummary_DEFAULT_PKG_TYPE` defines which
+package type is the default one.
+When calling :command:`feature_summary`, if the user did not set the package type
+explicitly, the package will be assigned to this category.
+
+This value must be one of the types defined in the
+:variable:`FeatureSummary_PKG_TYPES` global property unless the package type
+is set for all the packages.
+
+The default value for this global property is ``OPTIONAL``.
+
+#]=======================================================================]
+
+get_property(_fsPkgTypeIsSet GLOBAL PROPERTY FeatureSummary_PKG_TYPES SET)
+if(NOT _fsPkgTypeIsSet)
+ set_property(GLOBAL PROPERTY FeatureSummary_PKG_TYPES RUNTIME OPTIONAL RECOMMENDED REQUIRED)
+endif()
+
+get_property(_fsReqPkgTypesIsSet GLOBAL PROPERTY FeatureSummary_REQUIRED_PKG_TYPES SET)
+if(NOT _fsReqPkgTypesIsSet)
+ set_property(GLOBAL PROPERTY FeatureSummary_REQUIRED_PKG_TYPES REQUIRED)
+endif()
+
+get_property(_fsDefaultPkgTypeIsSet GLOBAL PROPERTY FeatureSummary_DEFAULT_PKG_TYPE SET)
+if(NOT _fsDefaultPkgTypeIsSet)
+ set_property(GLOBAL PROPERTY FeatureSummary_DEFAULT_PKG_TYPE OPTIONAL)
+endif()
+
+#[=======================================================================[.rst:
Functions
^^^^^^^^^
#]=======================================================================]
-include("${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake")
-
+include(CMakeParseArguments)
function(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet)
+ get_property(_fsPkgTypes GLOBAL PROPERTY FeatureSummary_PKG_TYPES)
+ get_property(_fsDefaultPkgType GLOBAL PROPERTY FeatureSummary_DEFAULT_PKG_TYPE)
+
set(_type "ANY")
- if("${_property}" MATCHES "REQUIRED_")
- set(_type "REQUIRED")
- elseif("${_property}" MATCHES "RECOMMENDED_")
- set(_type "RECOMMENDED")
- elseif("${_property}" MATCHES "RUNTIME_")
- set(_type "RUNTIME")
- elseif("${_property}" MATCHES "OPTIONAL_")
- set(_type "OPTIONAL")
- endif()
+ foreach(_fsPkgType ${_fsPkgTypes})
+ if("${_property}" MATCHES "${_fsPkgType}_PACKAGES_(NOT_)?FOUND")
+ set(_type "${_fsPkgType}")
+ break()
+ endif()
+ endforeach()
if("${_property}" MATCHES "PACKAGES_FOUND")
set(_property "PACKAGES_FOUND")
@@ -60,15 +120,30 @@ function(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet)
# does this package belong to the type we currently want to list ?
get_property(_currentType GLOBAL PROPERTY _CMAKE_${_currentFeature}_TYPE)
if(NOT _currentType)
- set(_currentType OPTIONAL)
+ list(FIND _fsPkgTypes "${_fsDefaultPkgType}" _defaultInPkgTypes)
+ if("${_defaultInPkgTypes}" STREQUAL "-1")
+ string(REGEX REPLACE ";([^;]+)$" " and \\1" _fsPkgTypes_msg "${_fsPkgTypes}")
+ string(REPLACE ";" ", " _fsPkgTypes_msg "${_fsPkgTypes_msg}")
+ message(FATAL_ERROR "Bad package property type ${_fsDefaultPkgType} used in global property FeatureSummary_DEFAULT_PKG_TYPE. "
+ "Valid types are ${_fsPkgTypes_msg}. "
+ "Either update FeatureSummary_DEFAULT_PKG_TYPE or add ${_fsDefaultPkgType} to the FeatureSummary_PKG_TYPES global property.")
+ endif()
+ set(_currentType ${_fsDefaultPkgType})
endif()
if("${_type}" STREQUAL ANY OR "${_type}" STREQUAL "${_currentType}")
-
# check whether the current feature/package should be in the output depending on whether it was QUIET or not
set(includeThisOne TRUE)
+ set(_required FALSE)
# skip QUIET packages, except if they are REQUIRED or INCLUDE_QUIET_PACKAGES has been set
- if((NOT "${_currentType}" STREQUAL "REQUIRED") AND NOT _includeQuiet)
+ get_property(_fsReqPkgTypes GLOBAL PROPERTY FeatureSummary_REQUIRED_PKG_TYPES)
+ foreach(_fsReqPkgType ${_fsReqPkgTypes})
+ if("${_currentType}" STREQUAL "${_fsReqPkgType}")
+ set(_required TRUE)
+ break()
+ endif()
+ endforeach()
+ if(NOT _required AND NOT _includeQuiet)
get_property(_isQuiet GLOBAL PROPERTY _CMAKE_${_currentFeature}_QUIET)
if(_isQuiet)
set(includeThisOne FALSE)
@@ -90,11 +165,11 @@ function(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet)
endif()
get_property(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_DESCRIPTION)
if(_info)
- string(APPEND _currentFeatureText " , ${_info}")
+ string(APPEND _currentFeatureText ", ${_info}")
endif()
get_property(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_URL)
if(_info)
- string(APPEND _currentFeatureText " , <${_info}>")
+ string(APPEND _currentFeatureText ", <${_info}>")
endif()
get_property(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_PURPOSE)
@@ -121,8 +196,11 @@ endfunction()
[VAR <variable_name>]
[INCLUDE_QUIET_PACKAGES]
[FATAL_ON_MISSING_REQUIRED_PACKAGES]
- [DESCRIPTION "Found packages:"]
- WHAT (ALL | PACKAGES_FOUND | PACKAGES_NOT_FOUND
+ [DESCRIPTION "<description>"]
+ [QUIET_ON_EMPTY]
+ WHAT (ALL
+ | PACKAGES_FOUND | PACKAGES_NOT_FOUND
+ | <TYPE>_PACKAGES_FOUND | <TYPE>_PACKAGES_NOT_FOUND
| ENABLED_FEATURES | DISABLED_FEATURES)
)
@@ -146,22 +224,15 @@ endfunction()
the list of all packages which have been found
``PACKAGES_NOT_FOUND``
the list of all packages which have not been found
- ``OPTIONAL_PACKAGES_FOUND``
- only those packages which have been found which have the type OPTIONAL
- ``OPTIONAL_PACKAGES_NOT_FOUND``
- only those packages which have not been found which have the type OPTIONAL
- ``RECOMMENDED_PACKAGES_FOUND``
- only those packages which have been found which have the type RECOMMENDED
- ``RECOMMENDED_PACKAGES_NOT_FOUND``
- only those packages which have not been found which have the type RECOMMENDED
- ``REQUIRED_PACKAGES_FOUND``
- only those packages which have been found which have the type REQUIRED
- ``REQUIRED_PACKAGES_NOT_FOUND``
- only those packages which have not been found which have the type REQUIRED
- ``RUNTIME_PACKAGES_FOUND``
- only those packages which have been found which have the type RUNTIME
- ``RUNTIME_PACKAGES_NOT_FOUND``
- only those packages which have not been found which have the type RUNTIME
+
+ For each package type ``<TYPE>`` defined by the
+ :variable:`FeatureSummary_PKG_TYPES` global property, the following
+ information can also be used:
+
+ ``<TYPE>_PACKAGES_FOUND``
+ only those packages which have been found which have the type <TYPE>
+ ``<TYPE>_PACKAGES_NOT_FOUND``
+ only those packages which have not been found which have the type <TYPE>
With the exception of the ``ALL`` value, these values can be combined
in order to customize the output. For example:
@@ -176,11 +247,24 @@ endfunction()
information is "printed" into the specified variable. If ``FILENAME`` is
not used, the information is printed to the terminal. Using the
``DESCRIPTION`` option a description or headline can be set which will be
- printed above the actual content. If ``INCLUDE_QUIET_PACKAGES`` is given,
- packages which have been searched with ``find_package(... QUIET)`` will
- also be listed. By default they are skipped. If
- ``FATAL_ON_MISSING_REQUIRED_PACKAGES`` is given, CMake will abort if a
- package which is marked as ``REQUIRED`` has not been found.
+ printed above the actual content.
+ If ``INCLUDE_QUIET_PACKAGES`` is given, packages which have been searched with
+ ``find_package(... QUIET)`` will also be listed. By default they are skipped.
+ If ``FATAL_ON_MISSING_REQUIRED_PACKAGES`` is given, CMake will abort if a
+ package which is marked as one of the package types listed in the
+ :variable:`FeatureSummary_REQUIRED_PKG_TYPES` global property has not been
+ found.
+ The default value for the :variable:`FeatureSummary_REQUIRED_PKG_TYPES` global
+ property is ``REQUIRED``.
+
+ The :variable:`FeatureSummary_DEFAULT_PKG_TYPE` global property can be
+ modified to change the default package type assigned when not explicitly
+ assigned by the user.
+
+ If the ``QUIET_ON_EMPTY`` option is used, if only one type of package was
+ requested, and no packages belonging to that category were found, then no
+ output (including the ``DESCRIPTION``) is printed or added to the ``VAR``
+ variable.
Example 1, append everything to a file:
@@ -201,11 +285,28 @@ endfunction()
DESCRIPTION "Enabled Features:"
VAR enabledFeaturesText)
message(STATUS "${enabledFeaturesText}")
+
+ Example 3, change default package types and print only the categories that
+ are not empty:
+
+ .. code-block:: cmake
+
+ include(FeatureSummary)
+ set_property(GLOBAL APPEND PROPERTY FeatureSummary_PKG_TYPES BUILD)
+ find_package(FOO)
+ set_package_properties(FOO PROPERTIES TYPE BUILD)
+ feature_summary(WHAT BUILD_PACKAGES_FOUND
+ Description "Build tools found:"
+ QUIET_ON_EMPTY)
+ feature_summary(WHAT BUILD_PACKAGES_NOT_FOUND
+ Description "Build tools not found:"
+ QUIET_ON_EMPTY)
+
#]=======================================================================]
function(FEATURE_SUMMARY)
# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
- set(options APPEND INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
+ set(options APPEND INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES QUIET_ON_EMPTY)
set(oneValueArgs FILENAME VAR DESCRIPTION)
set(multiValueArgs WHAT)
@@ -222,40 +323,42 @@ function(FEATURE_SUMMARY)
set(validWhatParts "ENABLED_FEATURES"
"DISABLED_FEATURES"
"PACKAGES_FOUND"
- "PACKAGES_NOT_FOUND"
- "OPTIONAL_PACKAGES_FOUND"
- "OPTIONAL_PACKAGES_NOT_FOUND"
- "RECOMMENDED_PACKAGES_FOUND"
- "RECOMMENDED_PACKAGES_NOT_FOUND"
- "REQUIRED_PACKAGES_FOUND"
- "REQUIRED_PACKAGES_NOT_FOUND"
- "RUNTIME_PACKAGES_FOUND"
- "RUNTIME_PACKAGES_NOT_FOUND")
+ "PACKAGES_NOT_FOUND")
+
+ get_property(_fsPkgTypes GLOBAL PROPERTY FeatureSummary_PKG_TYPES)
+ get_property(_fsReqPkgTypes GLOBAL PROPERTY FeatureSummary_REQUIRED_PKG_TYPES)
+ foreach(_fsPkgType ${_fsPkgTypes})
+ list(APPEND validWhatParts "${_fsPkgType}_PACKAGES_FOUND"
+ "${_fsPkgType}_PACKAGES_NOT_FOUND")
+ endforeach()
list(FIND validWhatParts "${_FS_WHAT}" indexInList)
if(NOT "${indexInList}" STREQUAL "-1")
_FS_GET_FEATURE_SUMMARY( ${_FS_WHAT} _featureSummary ${_FS_INCLUDE_QUIET_PACKAGES} )
- set(_fullText "${_FS_DESCRIPTION}${_featureSummary}\n")
- if (("${_FS_WHAT}" STREQUAL "REQUIRED_PACKAGES_NOT_FOUND") AND _featureSummary)
- set(requiredPackagesNotFound TRUE)
+ if(_featureSummary OR NOT _FS_QUIET_ON_EMPTY)
+ set(_fullText "${_FS_DESCRIPTION}${_featureSummary}\n")
+ endif()
+
+ if(_featureSummary)
+ foreach(_fsReqPkgType ${_fsReqPkgTypes})
+ if("${_FS_WHAT}" STREQUAL "${_fsReqPkgType}_PACKAGES_NOT_FOUND")
+ set(requiredPackagesNotFound TRUE)
+ break()
+ endif()
+ endforeach()
endif()
else()
if("${_FS_WHAT}" STREQUAL "ALL")
- set(allWhatParts "ENABLED_FEATURES"
- "RUNTIME_PACKAGES_FOUND"
- "OPTIONAL_PACKAGES_FOUND"
- "RECOMMENDED_PACKAGES_FOUND"
- "REQUIRED_PACKAGES_FOUND"
-
- "DISABLED_FEATURES"
- "RUNTIME_PACKAGES_NOT_FOUND"
- "OPTIONAL_PACKAGES_NOT_FOUND"
- "RECOMMENDED_PACKAGES_NOT_FOUND"
- "REQUIRED_PACKAGES_NOT_FOUND"
- )
-
+ set(allWhatParts "ENABLED_FEATURES")
+ foreach(_fsPkgType ${_fsPkgTypes})
+ list(APPEND allWhatParts "${_fsPkgType}_PACKAGES_FOUND")
+ endforeach()
+ list(APPEND allWhatParts "DISABLED_FEATURES")
+ foreach(_fsPkgType ${_fsPkgTypes})
+ list(APPEND allWhatParts "${_fsPkgType}_PACKAGES_NOT_FOUND")
+ endforeach()
else()
set(allWhatParts)
foreach(part ${_FS_WHAT})
@@ -276,45 +379,49 @@ function(FEATURE_SUMMARY)
set(title_DISABLED_FEATURES "The following features have been disabled:")
set(title_PACKAGES_FOUND "The following packages have been found:")
set(title_PACKAGES_NOT_FOUND "The following packages have not been found:")
- set(title_OPTIONAL_PACKAGES_FOUND "The following OPTIONAL packages have been found:")
- set(title_OPTIONAL_PACKAGES_NOT_FOUND "The following OPTIONAL packages have not been found:")
- set(title_RECOMMENDED_PACKAGES_FOUND "The following RECOMMENDED packages have been found:")
- set(title_RECOMMENDED_PACKAGES_NOT_FOUND "The following RECOMMENDED packages have not been found:")
- set(title_REQUIRED_PACKAGES_FOUND "The following REQUIRED packages have been found:")
- set(title_REQUIRED_PACKAGES_NOT_FOUND "The following REQUIRED packages have not been found:")
- set(title_RUNTIME_PACKAGES_FOUND "The following RUNTIME packages have been found:")
- set(title_RUNTIME_PACKAGES_NOT_FOUND "The following RUNTIME packages have not been found:")
+ foreach(_fsPkgType ${_fsPkgTypes})
+ set(title_${_fsPkgType}_PACKAGES_FOUND "The following ${_fsPkgType} packages have been found:")
+ set(title_${_fsPkgType}_PACKAGES_NOT_FOUND "The following ${_fsPkgType} packages have not been found:")
+ endforeach()
set(_fullText "${_FS_DESCRIPTION}")
foreach(part ${allWhatParts})
set(_tmp)
_FS_GET_FEATURE_SUMMARY( ${part} _tmp ${_FS_INCLUDE_QUIET_PACKAGES})
if(_tmp)
- string(APPEND _fullText "\n-- ${title_${part}}\n${_tmp}\n")
- if("${part}" STREQUAL "REQUIRED_PACKAGES_NOT_FOUND")
- set(requiredPackagesNotFound TRUE)
+ if(_fullText)
+ string(APPEND _fullText "\n-- ")
endif()
+ string(APPEND _fullText "${title_${part}}\n${_tmp}\n")
+ foreach(_fsReqPkgType ${_fsReqPkgTypes})
+ if("${part}" STREQUAL "${_fsReqPkgType}_PACKAGES_NOT_FOUND")
+ set(requiredPackagesNotFound TRUE)
+ break()
+ endif()
+ endforeach()
endif()
endforeach()
endif()
- if(_FS_FILENAME)
- if(_FS_APPEND)
- file(APPEND "${_FS_FILENAME}" "${_fullText}")
+ if(_fullText OR NOT _FS_QUIET_ON_EMPTY)
+ if(_FS_FILENAME)
+ if(_FS_APPEND)
+ file(APPEND "${_FS_FILENAME}" "${_fullText}")
+ else()
+ file(WRITE "${_FS_FILENAME}" "${_fullText}")
+ endif()
+
else()
- file(WRITE "${_FS_FILENAME}" "${_fullText}")
+ if(NOT _FS_VAR)
+ message(STATUS "${_fullText}")
+ endif()
endif()
- else()
- if(NOT _FS_VAR)
- message(STATUS "${_fullText}")
+ if(_FS_VAR)
+ set(${_FS_VAR} "${_fullText}" PARENT_SCOPE)
endif()
endif()
- if(_FS_VAR)
- set(${_FS_VAR} "${_fullText}" PARENT_SCOPE)
- endif()
-
if(requiredPackagesNotFound AND _FS_FATAL_ON_MISSING_REQUIRED_PACKAGES)
message(FATAL_ERROR "feature_summary() Error: REQUIRED package(s) are missing, aborting CMake run.")
endif()
@@ -365,7 +472,8 @@ endfunction()
TYPEs (``RUNTIME < OPTIONAL < RECOMMENDED < REQUIRED``), lower TYPEs are
ignored. The ``TYPE`` property is project-specific, so it cannot be set
by the Find-module, but must be set in the project.
-
+ Type accepted can be changed by setting the
+ :variable:`FeatureSummary_PKG_TYPES` global property.
``PURPOSE <purpose>``
This describes which features this package enables in the
@@ -438,25 +546,28 @@ function(SET_PACKAGE_PROPERTIES _name _props)
set_property(GLOBAL APPEND PROPERTY _CMAKE_${_name}_PURPOSE "${_SPP_PURPOSE}" )
endif()
- # handle the TYPE
- if(NOT _SPP_TYPE)
- set(_SPP_TYPE OPTIONAL)
- endif()
+ get_property(_fsPkgTypes GLOBAL PROPERTY FeatureSummary_PKG_TYPES)
+ get_property(_fsDefaultPkgType GLOBAL PROPERTY FeatureSummary_DEFAULT_PKG_TYPE)
- # List the supported types, according to their priority
- set(validTypes "RUNTIME" "OPTIONAL" "RECOMMENDED" "REQUIRED" )
- list(FIND validTypes ${_SPP_TYPE} _typeIndexInList)
- if("${_typeIndexInList}" STREQUAL "-1" )
- message(FATAL_ERROR "Bad package property type ${_SPP_TYPE} used in SET_PACKAGE_PROPERTIES(). "
- "Valid types are OPTIONAL, RECOMMENDED, REQUIRED and RUNTIME." )
- endif()
+ # handle the TYPE
+ if(DEFINED _SPP_TYPE)
+ # Supported types are listed in FeatureSummary_PKG_TYPES according to their priority
+ get_property(_fsPkgTypes GLOBAL PROPERTY FeatureSummary_PKG_TYPES)
+ list(FIND _fsPkgTypes ${_SPP_TYPE} _typeIndexInList)
+ if("${_typeIndexInList}" STREQUAL "-1" )
+ string(REGEX REPLACE ";([^;]+)$" " and \\1" _fsPkgTypes_msg "${_fsPkgTypes}")
+ string(REPLACE ";" ", " _fsPkgTypes_msg "${_fsPkgTypes_msg}")
+ message(FATAL_ERROR "Bad package property type ${_SPP_TYPE} used in SET_PACKAGE_PROPERTIES(). "
+ "Valid types are ${_fsPkgTypes_msg}." )
+ endif()
- get_property(_previousType GLOBAL PROPERTY _CMAKE_${_name}_TYPE)
- list(FIND validTypes "${_previousType}" _prevTypeIndexInList)
+ get_property(_previousType GLOBAL PROPERTY _CMAKE_${_name}_TYPE)
+ list(FIND _fsPkgTypes "${_previousType}" _prevTypeIndexInList)
- # make sure a previously set TYPE is not overridden with a lower new TYPE:
- if("${_typeIndexInList}" GREATER "${_prevTypeIndexInList}")
- set_property(GLOBAL PROPERTY _CMAKE_${_name}_TYPE "${_SPP_TYPE}" )
+ # make sure a previously set TYPE is not overridden with a lower new TYPE:
+ if("${_typeIndexInList}" GREATER "${_prevTypeIndexInList}")
+ set_property(GLOBAL PROPERTY _CMAKE_${_name}_TYPE "${_SPP_TYPE}" )
+ endif()
endif()
endfunction()
@@ -469,7 +580,8 @@ endfunction()
add_feature_info(<name> <enabled> <description>)
Use this macro to add information about a feature with the given ``<name>``.
- ``<enabled>`` contains whether this feature is enabled or not.
+ ``<enabled>`` contains whether this feature is enabled or not. It can be a
+ variable or a list of conditions.
``<description>`` is a text describing the feature. The information can
be displayed using ``feature_summary()`` for ``ENABLED_FEATURES`` and
``DISABLED_FEATURES`` respectively.
@@ -481,7 +593,16 @@ endfunction()
option(WITH_FOO "Help for foo" ON)
add_feature_info(Foo WITH_FOO "The Foo feature provides very cool stuff.")
#]=======================================================================]
-function(ADD_FEATURE_INFO _name _enabled _desc)
+function(ADD_FEATURE_INFO _name _depends _desc)
+ set(_enabled 1)
+ foreach(_d ${_depends})
+ string(REGEX REPLACE " +" ";" _d "${_d}")
+ if(${_d})
+ else()
+ set(_enabled 0)
+ break()
+ endif()
+ endforeach()
if (${_enabled})
set_property(GLOBAL APPEND PROPERTY ENABLED_FEATURES "${_name}")
else ()
@@ -514,6 +635,7 @@ CMake versions:
can be set are added automatically by the ``find_package()`` command.
#]=======================================================================]
function(SET_PACKAGE_INFO _name _desc)
+ message(DEPRECATION "SET_PACKAGE_INFO is deprecated. Use SET_PACKAGE_PROPERTIES instead.")
unset(_url)
unset(_purpose)
if(ARGC GREATER 2)
@@ -543,6 +665,7 @@ endfunction()
set_package_info(<name> <description> <url>)
#]=======================================================================]
function(SET_FEATURE_INFO)
+ message(DEPRECATION "SET_FEATURE_INFO is deprecated. Use ADD_FEATURE_INFO instead.")
SET_PACKAGE_INFO(${ARGN})
endfunction()
@@ -560,6 +683,8 @@ endfunction()
feature_summary(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
#]=======================================================================]
function(PRINT_ENABLED_FEATURES)
+ message(DEPRECATION "PRINT_ENABLED_FEATURES is deprecated. Use
+ feature_summary(WHAT ENABLED_FEATURES DESCRIPTION \"Enabled features:\")")
FEATURE_SUMMARY(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
endfunction()
@@ -577,5 +702,7 @@ endfunction()
feature_summary(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")
#]=======================================================================]
function(PRINT_DISABLED_FEATURES)
+ message(DEPRECATION "PRINT_DISABLED_FEATURES is deprecated. Use
+ feature_summary(WHAT DISABLED_FEATURES DESCRIPTION \"Disabled features:\")")
FEATURE_SUMMARY(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")
endfunction()
diff --git a/Modules/FindALSA.cmake b/Modules/FindALSA.cmake
index d0ffa03..fa9a434 100644
--- a/Modules/FindALSA.cmake
+++ b/Modules/FindALSA.cmake
@@ -39,8 +39,6 @@ if(ALSA_INCLUDE_DIR AND EXISTS "${ALSA_INCLUDE_DIR}/alsa/version.h")
unset(alsa_version_str)
endif()
-# handle the QUIETLY and REQUIRED arguments and set ALSA_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALSA
REQUIRED_VARS ALSA_LIBRARY ALSA_INCLUDE_DIR
diff --git a/Modules/FindASPELL.cmake b/Modules/FindASPELL.cmake
index 8f2b007..6944ac1 100644
--- a/Modules/FindASPELL.cmake
+++ b/Modules/FindASPELL.cmake
@@ -25,8 +25,6 @@ find_program(ASPELL_EXECUTABLE
find_library(ASPELL_LIBRARIES NAMES aspell aspell-15 libaspell-15 libaspell)
-# handle the QUIETLY and REQUIRED arguments and set ASPELL_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ASPELL DEFAULT_MSG ASPELL_LIBRARIES ASPELL_INCLUDE_DIR ASPELL_EXECUTABLE)
diff --git a/Modules/FindAVIFile.cmake b/Modules/FindAVIFile.cmake
index 38701be..88a2a25 100644
--- a/Modules/FindAVIFile.cmake
+++ b/Modules/FindAVIFile.cmake
@@ -32,8 +32,6 @@ if (UNIX)
endif ()
-# handle the QUIETLY and REQUIRED arguments and set AVIFILE_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(AVIFile DEFAULT_MSG AVIFILE_INCLUDE_DIR AVIFILE_AVIPLAY_LIBRARY)
diff --git a/Modules/FindArmadillo.cmake b/Modules/FindArmadillo.cmake
index fab04c2..95f0c56 100644
--- a/Modules/FindArmadillo.cmake
+++ b/Modules/FindArmadillo.cmake
@@ -73,10 +73,6 @@ if(ARMADILLO_INCLUDE_DIR)
set(ARMADILLO_VERSION_STRING "${ARMADILLO_VERSION_MAJOR}.${ARMADILLO_VERSION_MINOR}.${ARMADILLO_VERSION_PATCH}")
endif ()
-#======================
-
-
-# Checks 'REQUIRED', 'QUIET' and versions.
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(Armadillo
REQUIRED_VARS ARMADILLO_LIBRARY ARMADILLO_INCLUDE_DIR
@@ -88,10 +84,7 @@ if (ARMADILLO_FOUND)
set(ARMADILLO_LIBRARIES ${ARMADILLO_LIBRARY})
endif ()
-
# Hide internal variables
mark_as_advanced(
ARMADILLO_INCLUDE_DIR
ARMADILLO_LIBRARY)
-
-#======================
diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake
index d40b806..d684ccd 100644
--- a/Modules/FindBISON.cmake
+++ b/Modules/FindBISON.cmake
@@ -84,8 +84,6 @@
find_program(BISON_EXECUTABLE NAMES bison win_bison DOC "path to the bison executable")
mark_as_advanced(BISON_EXECUTABLE)
-include(CMakeParseArguments)
-
if(BISON_EXECUTABLE)
# the bison commands should be executed with the C locale, otherwise
# the message (which are parsed) may be translated
@@ -253,5 +251,3 @@ endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(BISON REQUIRED_VARS BISON_EXECUTABLE
VERSION_VAR BISON_VERSION)
-
-# FindBISON.cmake ends here
diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake
index 2d93eba..d2307f1 100644
--- a/Modules/FindBZip2.cmake
+++ b/Modules/FindBZip2.cmake
@@ -45,8 +45,6 @@ if (BZIP2_INCLUDE_DIR AND EXISTS "${BZIP2_INCLUDE_DIR}/bzlib.h")
string(REGEX REPLACE ".* bzip2/libbzip2 version ([0-9]+\\.[^ ]+) of [0-9]+ .*" "\\1" BZIP2_VERSION_STRING "${BZLIB_H}")
endif ()
-# handle the QUIETLY and REQUIRED arguments and set BZip2_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2
REQUIRED_VARS BZIP2_LIBRARIES BZIP2_INCLUDE_DIR
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 69476203..e795aad 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -892,7 +892,7 @@ endfunction()
# This function would append corresponding directories if MSVC is a current compiler,
# so having `BOOST_ROOT` would be enough to specify to find everything.
#
-macro(_Boost_UPDATE_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS componentlibvar basedir)
+macro(_Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS componentlibvar basedir)
if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_arch_suffix 64)
@@ -900,19 +900,19 @@ macro(_Boost_UPDATE_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS componentlibvar base
set(_arch_suffix 32)
endif()
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10)
- list(APPEND ${componentlibvar} ${${basedir}}/lib${_arch_suffix}-msvc-15.0)
+ list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-15.0)
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19)
- list(APPEND ${componentlibvar} ${${basedir}}/lib${_arch_suffix}-msvc-14.0)
+ list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.0)
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18)
- list(APPEND ${componentlibvar} ${${basedir}}/lib${_arch_suffix}-msvc-12.0)
+ list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-12.0)
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17)
- list(APPEND ${componentlibvar} ${${basedir}}/lib${_arch_suffix}-msvc-11.0)
+ list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-11.0)
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
- list(APPEND ${componentlibvar} ${${basedir}}/lib${_arch_suffix}-msvc-10.0)
+ list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-10.0)
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15)
- list(APPEND ${componentlibvar} ${${basedir}}/lib${_arch_suffix}-msvc-9.0)
+ list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-9.0)
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14)
- list(APPEND ${componentlibvar} ${${basedir}}/lib${_arch_suffix}-msvc-8.0)
+ list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-8.0)
endif()
endif()
endmacro()
@@ -1332,13 +1332,13 @@ string(APPEND _boost_DEBUG_ABI_TAG "d")
# p using the STLport standard library rather than the
# default one supplied with your compiler
if(Boost_USE_STLPORT)
- set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}p")
- set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}p")
+ string(APPEND _boost_RELEASE_ABI_TAG "p")
+ string(APPEND _boost_DEBUG_ABI_TAG "p")
endif()
# n using the STLport deprecated "native iostreams" feature
if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS)
- set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}n")
- set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}n")
+ string(APPEND _boost_RELEASE_ABI_TAG "n")
+ string(APPEND _boost_DEBUG_ABI_TAG "n")
endif()
if(Boost_DEBUG)
@@ -1376,10 +1376,10 @@ foreach(c DEBUG RELEASE)
if(BOOST_ROOT)
list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_ROOT}/lib ${BOOST_ROOT}/stage/lib)
- _Boost_UPDATE_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} BOOST_ROOT)
+ _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${BOOST_ROOT}")
elseif(_ENV_BOOST_ROOT)
list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_ROOT}/lib ${_ENV_BOOST_ROOT}/stage/lib)
- _Boost_UPDATE_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} _ENV_BOOST_ROOT)
+ _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${_ENV_BOOST_ROOT}")
endif()
list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c}
@@ -1387,6 +1387,7 @@ foreach(c DEBUG RELEASE)
${Boost_INCLUDE_DIR}/../lib
${Boost_INCLUDE_DIR}/stage/lib
)
+ _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${Boost_INCLUDE_DIR}/..")
if( Boost_NO_SYSTEM_PATHS )
list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH)
else()
@@ -1395,6 +1396,7 @@ foreach(c DEBUG RELEASE)
C:/boost
/sw/local/lib
)
+ _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "C:/boost")
endif()
endif()
endforeach()
@@ -1409,9 +1411,9 @@ endif()
if( Boost_USE_STATIC_LIBS )
set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
if(WIN32)
- set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ list(INSERT CMAKE_FIND_LIBRARY_SUFFIXES 0 .lib .a)
else()
- set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
endif()
endif()
@@ -1437,7 +1439,7 @@ endif()
set(_boost_STATIC_RUNTIME_WORKAROUND false)
if(WIN32 AND Boost_USE_STATIC_LIBS)
if(NOT DEFINED Boost_USE_STATIC_RUNTIME)
- set(_boost_STATIC_RUNTIME_WORKAROUND true)
+ set(_boost_STATIC_RUNTIME_WORKAROUND TRUE)
endif()
endif()
@@ -1461,7 +1463,7 @@ if(NOT _Boost_THREAD_DEPENDENCY_LIBS EQUAL -1)
endif()
# If the user changed any of our control inputs flush previous results.
-if(_Boost_CHANGE_LIBDIR OR _Boost_CHANGE_LIBNAME)
+if(_Boost_CHANGE_LIBDIR_DEBUG OR _Boost_CHANGE_LIBDIR_RELEASE OR _Boost_CHANGE_LIBNAME)
foreach(COMPONENT ${_Boost_COMPONENTS_SEARCHED})
string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
foreach(c DEBUG RELEASE)
@@ -1700,13 +1702,11 @@ if(Boost_FOUND)
endif()
if(EXISTS "${_boost_LIB_DIR}/lib")
- set(_boost_LIB_DIR ${_boost_LIB_DIR}/lib)
+ string(APPEND _boost_LIB_DIR /lib)
+ elseif(EXISTS "${_boost_LIB_DIR}/stage/lib")
+ string(APPEND _boost_LIB_DIR "/stage/lib")
else()
- if(EXISTS "${_boost_LIB_DIR}/stage/lib")
- set(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib)
- else()
- set(_boost_LIB_DIR "")
- endif()
+ set(_boost_LIB_DIR "")
endif()
if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
diff --git a/Modules/FindBullet.cmake b/Modules/FindBullet.cmake
index d000f79..fc6695c 100644
--- a/Modules/FindBullet.cmake
+++ b/Modules/FindBullet.cmake
@@ -78,8 +78,6 @@ _FIND_BULLET_LIBRARY(BULLET_SOFTBODY_LIBRARY BulletSoftBody)
_FIND_BULLET_LIBRARY(BULLET_SOFTBODY_LIBRARY_DEBUG BulletSoftBody_Debug BulletSoftBody_d)
-# handle the QUIETLY and REQUIRED arguments and set BULLET_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Bullet DEFAULT_MSG
BULLET_DYNAMICS_LIBRARY BULLET_COLLISION_LIBRARY BULLET_MATH_LIBRARY
diff --git a/Modules/FindCUDA/select_compute_arch.cmake b/Modules/FindCUDA/select_compute_arch.cmake
index 5ce71a9..8fb44d8 100644
--- a/Modules/FindCUDA/select_compute_arch.cmake
+++ b/Modules/FindCUDA/select_compute_arch.cmake
@@ -44,9 +44,10 @@ endif ()
#
function(CUDA_DETECT_INSTALLED_GPUS OUT_VARIABLE)
if(NOT CUDA_GPU_DETECT_OUTPUT)
- set(cufile ${PROJECT_BINARY_DIR}/detect_cuda_archs.cu)
+ set(file ${PROJECT_BINARY_DIR}/detect_cuda_compute_capabilities.cpp)
- file(WRITE ${cufile} ""
+ file(WRITE ${file} ""
+ "#include <cuda_runtime.h>\n"
"#include <cstdio>\n"
"int main()\n"
"{\n"
@@ -62,14 +63,15 @@ function(CUDA_DETECT_INSTALLED_GPUS OUT_VARIABLE)
" return 0;\n"
"}\n")
- execute_process(COMMAND "${CUDA_NVCC_EXECUTABLE}" "--run" "${cufile}"
- WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/CMakeFiles/"
- RESULT_VARIABLE nvcc_res OUTPUT_VARIABLE nvcc_out
- ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
+ try_run(run_result compile_result ${PROJECT_BINARY_DIR} ${file}
+ CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${CUDA_INCLUDE_DIRS}"
+ LINK_LIBRARIES ${CUDA_LIBRARIES}
+ RUN_OUTPUT_VARIABLE compute_capabilities)
- if(nvcc_res EQUAL 0)
- string(REPLACE "2.1" "2.1(2.0)" nvcc_out "${nvcc_out}")
- set(CUDA_GPU_DETECT_OUTPUT ${nvcc_out} CACHE INTERNAL "Returned GPU architetures from detect_gpus tool" FORCE)
+ if(run_result EQUAL 0)
+ string(REPLACE "2.1" "2.1(2.0)" compute_capabilities "${compute_capabilities}")
+ set(CUDA_GPU_DETECT_OUTPUT ${compute_capabilities}
+ CACHE INTERNAL "Returned GPU architectures from detect_gpus tool" FORCE)
endif()
endif()
@@ -110,6 +112,7 @@ function(CUDA_SELECT_NVCC_ARCH_FLAGS out_variable)
list(REMOVE_DUPLICATES CUDA_ARCH_LIST)
foreach(arch_name ${CUDA_ARCH_LIST})
set(arch_bin)
+ set(arch_ptx)
set(add_ptx FALSE)
# Check to see if we are compiling PTX
if(arch_name MATCHES "(.*)\\+PTX$")
diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake
index 200f8c3..f4bcc36 100644
--- a/Modules/FindCURL.cmake
+++ b/Modules/FindCURL.cmake
@@ -44,8 +44,6 @@ if(CURL_INCLUDE_DIR)
endforeach()
endif()
-# handle the QUIETLY and REQUIRED arguments and set CURL_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CURL
REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR
diff --git a/Modules/FindCoin3D.cmake b/Modules/FindCoin3D.cmake
index fea644d..f11903d 100644
--- a/Modules/FindCoin3D.cmake
+++ b/Modules/FindCoin3D.cmake
@@ -70,11 +70,7 @@ else ()
endif ()
-# handle the QUIETLY and REQUIRED arguments and set COIN3D_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Coin3D DEFAULT_MSG COIN3D_LIBRARIES COIN3D_INCLUDE_DIRS)
mark_as_advanced(COIN3D_INCLUDE_DIRS COIN3D_LIBRARIES )
-
-
diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake
index a0929ce..4365e99 100644
--- a/Modules/FindCurses.cmake
+++ b/Modules/FindCurses.cmake
@@ -190,8 +190,6 @@ endif()
set(CURSES_INCLUDE_DIRS ${CURSES_INCLUDE_PATH})
set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH}) # compatibility
-# handle the QUIETLY and REQUIRED arguments and set CURSES_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Curses DEFAULT_MSG
CURSES_LIBRARY CURSES_INCLUDE_PATH)
diff --git a/Modules/FindDart.cmake b/Modules/FindDart.cmake
index 37164e6..acd4ef6 100644
--- a/Modules/FindDart.cmake
+++ b/Modules/FindDart.cmake
@@ -26,8 +26,6 @@ find_path(DART_ROOT README.INSTALL
DOC "If you have Dart installed, where is it located?"
)
-# handle the QUIETLY and REQUIRED arguments and set DART_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Dart DEFAULT_MSG DART_ROOT)
diff --git a/Modules/FindDevIL.cmake b/Modules/FindDevIL.cmake
index dc8e38a..45fab82 100644
--- a/Modules/FindDevIL.cmake
+++ b/Modules/FindDevIL.cmake
@@ -67,6 +67,6 @@ find_library(ILU_LIBRARIES
#message("ILU_LIBRARIES is ${ILU_LIBRARIES}")
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(IL DEFAULT_MSG
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(DevIL DEFAULT_MSG
IL_LIBRARIES ILU_LIBRARIES
- ILUT_LIBRARIES IL_INCLUDE_DIR)
+ IL_INCLUDE_DIR)
diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake
index cc89203..09963fc 100644
--- a/Modules/FindEXPAT.cmake
+++ b/Modules/FindEXPAT.cmake
@@ -44,8 +44,6 @@ if (EXPAT_INCLUDE_DIR AND EXISTS "${EXPAT_INCLUDE_DIR}/expat.h")
endforeach()
endif ()
-# handle the QUIETLY and REQUIRED arguments and set EXPAT_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(EXPAT
REQUIRED_VARS EXPAT_LIBRARY EXPAT_INCLUDE_DIR
diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake
index 69cf513..fef7fb4 100644
--- a/Modules/FindFLEX.cmake
+++ b/Modules/FindFLEX.cmake
@@ -107,8 +107,6 @@ find_path(FLEX_INCLUDE_DIR FlexLexer.h
mark_as_advanced(FL_LIBRARY FLEX_INCLUDE_DIR)
-include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
-
set(FLEX_INCLUDE_DIRS ${FLEX_INCLUDE_DIR})
set(FLEX_LIBRARIES ${FL_LIBRARY})
@@ -218,5 +216,3 @@ endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FLEX REQUIRED_VARS FLEX_EXECUTABLE
VERSION_VAR FLEX_VERSION)
-
-# FindFLEX.cmake ends here
diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake
index 21a5d89..9ea77df 100644
--- a/Modules/FindFreetype.cmake
+++ b/Modules/FindFreetype.cmake
@@ -135,9 +135,6 @@ if(FREETYPE_INCLUDE_DIR_freetype2 AND FREETYPE_H)
endforeach()
endif()
-
-# handle the QUIETLY and REQUIRED arguments and set FREETYPE_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(
diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake
index 88c4180..0843d5f 100644
--- a/Modules/FindGIF.cmake
+++ b/Modules/FindGIF.cmake
@@ -91,8 +91,6 @@ if(GIF_INCLUDE_DIR)
CMAKE_POP_CHECK_STATE()
endif()
-# handle the QUIETLY and REQUIRED arguments and set GIF_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GIF REQUIRED_VARS GIF_LIBRARY GIF_INCLUDE_DIR
VERSION_VAR GIF_VERSION )
diff --git a/Modules/FindGSL.cmake b/Modules/FindGSL.cmake
index 98377a2..76059b3 100644
--- a/Modules/FindGSL.cmake
+++ b/Modules/FindGSL.cmake
@@ -55,7 +55,6 @@
# GSL_LIBRARY_DEBUG - Location of the debug GSL library (if any).
#
-# Include these modules to handle the QUIETLY and REQUIRED arguments.
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
#=============================================================================
@@ -136,7 +135,7 @@ if( NOT GSL_VERSION )
# 2. If gsl-config is not available, try looking in gsl/gsl_version.h
if( NOT GSL_VERSION AND EXISTS "${GSL_INCLUDE_DIRS}/gsl/gsl_version.h" )
file( STRINGS "${GSL_INCLUDE_DIRS}/gsl/gsl_version.h" gsl_version_h_contents REGEX "define GSL_VERSION" )
- string( REGEX REPLACE ".*([0-9].[0-9][0-9]).*" "\\1" GSL_VERSION ${gsl_version_h_contents} )
+ string( REGEX REPLACE ".*([0-9]\\.[0-9][0-9]?).*" "\\1" GSL_VERSION ${gsl_version_h_contents} )
endif()
# might also try scraping the directory name for a regex match "gsl-X.X"
diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake
index 78dc6ba..20d7924 100644
--- a/Modules/FindGTK2.cmake
+++ b/Modules/FindGTK2.cmake
@@ -165,7 +165,6 @@
#=============================================================
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
-include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
function(_GTK2_GET_VERSION _OUT_major _OUT_minor _OUT_micro _gtkversion_hdr)
file(STRINGS ${_gtkversion_hdr} _contents REGEX "#define GTK_M[A-Z]+_VERSION[ \t]+")
@@ -224,7 +223,10 @@ function(_GTK2_SIGCXX_GET_VERSION _OUT_major _OUT_minor _OUT_micro _sigcxxversio
set(${_OUT_minor} ${${_OUT_minor}} PARENT_SCOPE)
set(${_OUT_micro} ${${_OUT_micro}} PARENT_SCOPE)
else()
- message(FATAL_ERROR "Include file ${_gtkversion_hdr} does not exist")
+ # The header does not have the version macros; assume it is ``0.0.0``.
+ set(${_OUT_major} 0)
+ set(${_OUT_minor} 0)
+ set(${_OUT_micro} 0)
endif()
endfunction()
@@ -530,52 +532,54 @@ function(_GTK2_ADD_TARGET _var)
cmake_parse_arguments(_${_var} "" "" "GTK2_DEPENDS;GTK2_OPTIONAL_DEPENDS;OPTIONAL_INCLUDES" ${ARGN})
- if(GTK2_${_var}_FOUND AND NOT TARGET GTK2::${_basename})
- # Do not create the target if dependencies are missing
- foreach(_dep ${_${_var}_GTK2_DEPENDS})
- if(NOT TARGET GTK2::${_dep})
- return()
- endif()
- endforeach()
+ if(GTK2_${_var}_FOUND)
+ if(NOT TARGET GTK2::${_basename})
+ # Do not create the target if dependencies are missing
+ foreach(_dep ${_${_var}_GTK2_DEPENDS})
+ if(NOT TARGET GTK2::${_dep})
+ return()
+ endif()
+ endforeach()
- add_library(GTK2::${_basename} UNKNOWN IMPORTED)
+ add_library(GTK2::${_basename} UNKNOWN IMPORTED)
- set(GTK2_TARGETS ${GTK2_TARGETS} GTK2::${_basename})
- set(GTK2_TARGETS ${GTK2_TARGETS} PARENT_SCOPE)
+ if(GTK2_${_var}_LIBRARY_RELEASE)
+ set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
+ set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_RELEASE "${GTK2_${_var}_LIBRARY_RELEASE}" )
+ endif()
- if(GTK2_${_var}_LIBRARY_RELEASE)
- set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
- set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_RELEASE "${GTK2_${_var}_LIBRARY_RELEASE}" )
- endif()
+ if(GTK2_${_var}_LIBRARY_DEBUG)
+ set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
+ set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_DEBUG "${GTK2_${_var}_LIBRARY_DEBUG}" )
+ endif()
- if(GTK2_${_var}_LIBRARY_DEBUG)
- set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
- set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_DEBUG "${GTK2_${_var}_LIBRARY_DEBUG}" )
- endif()
+ if(GTK2_${_var}_INCLUDE_DIR)
+ set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}_INCLUDE_DIR}")
+ endif()
- if(GTK2_${_var}_INCLUDE_DIR)
- set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}_INCLUDE_DIR}")
- endif()
+ if(GTK2_${_var}CONFIG_INCLUDE_DIR AND NOT "x${GTK2_${_var}CONFIG_INCLUDE_DIR}" STREQUAL "x${GTK2_${_var}_INCLUDE_DIR}")
+ set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}CONFIG_INCLUDE_DIR}")
+ endif()
- if(GTK2_${_var}CONFIG_INCLUDE_DIR AND NOT "x${GTK2_${_var}CONFIG_INCLUDE_DIR}" STREQUAL "x${GTK2_${_var}_INCLUDE_DIR}")
- set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}CONFIG_INCLUDE_DIR}")
- endif()
+ if(GTK2_DEFINITIONS)
+ set_property(TARGET GTK2::${_basename} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${GTK2_DEFINITIONS}")
+ endif()
- if(GTK2_DEFINITIONS)
- set_property(TARGET GTK2::${_basename} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${GTK2_DEFINITIONS}")
- endif()
+ if(_${_var}_GTK2_DEPENDS)
+ _GTK2_ADD_TARGET_DEPENDS(${_var} ${_${_var}_GTK2_DEPENDS} ${_${_var}_GTK2_OPTIONAL_DEPENDS})
+ endif()
- if(_${_var}_GTK2_DEPENDS)
- _GTK2_ADD_TARGET_DEPENDS(${_var} ${_${_var}_GTK2_DEPENDS} ${_${_var}_GTK2_OPTIONAL_DEPENDS})
+ if(_${_var}_OPTIONAL_INCLUDES)
+ foreach(_D ${_${_var}_OPTIONAL_INCLUDES})
+ if(_D)
+ _GTK2_ADD_TARGET_INCLUDE_DIRS(${_var} ${_D})
+ endif()
+ endforeach()
+ endif()
endif()
- if(_${_var}_OPTIONAL_INCLUDES)
- foreach(_D ${_${_var}_OPTIONAL_INCLUDES})
- if(_D)
- _GTK2_ADD_TARGET_INCLUDE_DIRS(${_var} ${_D})
- endif()
- endforeach()
- endif()
+ set(GTK2_TARGETS ${GTK2_TARGETS} GTK2::${_basename})
+ set(GTK2_TARGETS ${GTK2_TARGETS} PARENT_SCOPE)
if(GTK2_USE_IMPORTED_TARGETS)
set(GTK2_${_var}_LIBRARY GTK2::${_basename} PARENT_SCOPE)
@@ -736,9 +740,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
if(APPLE)
_GTK2_FIND_LIBRARY (GDK gdk-quartz false true)
endif()
- if(NOT GTK2_GDK_FOUND)
- _GTK2_FIND_LIBRARY (GDK gdk-x11 false true)
- endif()
+ _GTK2_FIND_LIBRARY (GDK gdk-x11 false true)
else()
_GTK2_FIND_LIBRARY (GDK gdk-win32 false true)
endif()
@@ -750,9 +752,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
if(APPLE)
_GTK2_FIND_LIBRARY (GTK gtk-quartz false true)
endif()
- if(NOT GTK2_GTK_FOUND)
- _GTK2_FIND_LIBRARY (GTK gtk-x11 false true)
- endif()
+ _GTK2_FIND_LIBRARY (GTK gtk-x11 false true)
else()
_GTK2_FIND_LIBRARY (GTK gtk-win32 false true)
endif()
@@ -957,4 +957,3 @@ endif()
if(GTK2_INCLUDE_DIRS)
list(REMOVE_DUPLICATES GTK2_INCLUDE_DIRS)
endif()
-
diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake
index 76ab716..6540171 100644
--- a/Modules/FindGTest.cmake
+++ b/Modules/FindGTest.cmake
@@ -49,8 +49,8 @@
# The root directory of the Google Test installation (may also be
# set as an environment variable)
# ``GTEST_MSVC_SEARCH``
-# If compiling with MSVC, this variable can be set to ``MD`` or
-# ``MT`` (the default) to enable searching a GTest build tree
+# If compiling with MSVC, this variable can be set to ``MT`` or
+# ``MD`` (the default) to enable searching a GTest build tree
#
#
# Example usage
@@ -160,11 +160,17 @@ if(MSVC)
if(GTEST_MSVC_SEARCH STREQUAL "MD")
list(APPEND _gtest_libpath_suffixes
msvc/gtest-md/Debug
- msvc/gtest-md/Release)
+ msvc/gtest-md/Release
+ msvc/x64/Debug
+ msvc/x64/Release
+ )
elseif(GTEST_MSVC_SEARCH STREQUAL "MT")
list(APPEND _gtest_libpath_suffixes
msvc/gtest/Debug
- msvc/gtest/Release)
+ msvc/gtest/Release
+ msvc/x64/Debug
+ msvc/x64/Release
+ )
endif()
endif()
diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake
index 7718468..8035507 100644
--- a/Modules/FindGettext.cmake
+++ b/Modules/FindGettext.cmake
@@ -77,8 +77,6 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gettext
REQUIRED_VARS GETTEXT_MSGMERGE_EXECUTABLE GETTEXT_MSGFMT_EXECUTABLE
VERSION_VAR GETTEXT_VERSION_STRING)
-include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
-
function(_GETTEXT_GET_UNIQUE_TARGET_NAME _name _unique_name)
set(propertyName "_GETTEXT_UNIQUE_COUNTER_${_name}")
get_property(currentCounter GLOBAL PROPERTY "${propertyName}")
diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake
index 5d38193..b830c08 100644
--- a/Modules/FindGit.cmake
+++ b/Modules/FindGit.cmake
@@ -30,7 +30,7 @@ set(git_names git eg)
# Prefer .cmd variants on Windows unless running in a Makefile
# in the MSYS shell.
#
-if(WIN32)
+if(CMAKE_HOST_WIN32)
if(NOT CMAKE_GENERATOR MATCHES "MSYS")
set(git_names git.cmd git eg.cmd eg)
# GitHub search path for Windows
@@ -65,9 +65,6 @@ if(GIT_EXECUTABLE)
unset(git_version)
endif()
-# Handle the QUIETLY and REQUIRED arguments and set Git_FOUND to TRUE if
-# all listed variables are TRUE
-
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(Git
REQUIRED_VARS GIT_EXECUTABLE
diff --git a/Modules/FindGnuTLS.cmake b/Modules/FindGnuTLS.cmake
index a6ab092..1a97d99 100644
--- a/Modules/FindGnuTLS.cmake
+++ b/Modules/FindGnuTLS.cmake
@@ -50,8 +50,6 @@ find_library(GNUTLS_LIBRARY NAMES gnutls libgnutls
mark_as_advanced(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY)
-# handle the QUIETLY and REQUIRED arguments and set GNUTLS_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GnuTLS
REQUIRED_VARS GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR
@@ -61,4 +59,3 @@ if(GNUTLS_FOUND)
set(GNUTLS_LIBRARIES ${GNUTLS_LIBRARY})
set(GNUTLS_INCLUDE_DIRS ${GNUTLS_INCLUDE_DIR})
endif()
-
diff --git a/Modules/FindGnuplot.cmake b/Modules/FindGnuplot.cmake
index 9ace651..aa4cd6c 100644
--- a/Modules/FindGnuplot.cmake
+++ b/Modules/FindGnuplot.cmake
@@ -46,12 +46,9 @@ endif()
# for compatibility
set(GNUPLOT ${GNUPLOT_EXECUTABLE})
-# handle the QUIETLY and REQUIRED arguments and set GNUPLOT_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gnuplot
REQUIRED_VARS GNUPLOT_EXECUTABLE
VERSION_VAR GNUPLOT_VERSION_STRING)
mark_as_advanced( GNUPLOT_EXECUTABLE )
-
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 16764e0..65a825d 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -340,71 +340,61 @@ macro( _HDF5_parse_compile_line
libraries
libraries_hl)
- # Match the include paths
- set( RE " -I *([^\" ]+|\"[^\"]+\")")
- string( REGEX MATCHALL "${RE}" include_path_flags "${${compile_line_var}}")
- foreach( IPATH IN LISTS include_path_flags )
- string( REGEX REPLACE "${RE}" "\\1" IPATH "${IPATH}" )
- list( APPEND ${include_paths} ${IPATH} )
- endforeach()
-
- # Match the definitions
- set( RE " -D([^ ]*)")
- string( REGEX MATCHALL "${RE}" definition_flags "${${compile_line_var}}" )
- foreach( DEF IN LISTS definition_flags )
- string( STRIP "${DEF}" DEF )
- list( APPEND ${definitions} ${DEF} )
- endforeach()
-
- # Match the library paths
- set( RE " -L *([^\" ]+|\"[^\"]+\")")
- string( REGEX MATCHALL "${RE}" library_path_flags "${${compile_line_var}}")
- foreach( LPATH IN LISTS library_path_flags )
- string( REGEX REPLACE "${RE}" "\\1" LPATH "${LPATH}" )
- list( APPEND ${library_paths} ${LPATH} )
- endforeach()
-
- # now search for the lib names specified in the compile line (match -l...)
- # match only -l's preceded by a space or comma
- set( RE " -l *([^\" ]+|\"[^\"]+\")")
- string( REGEX MATCHALL "${RE}" library_name_flags "${${compile_line_var}}")
- foreach( LNAME IN LISTS library_name_flags )
- string( REGEX REPLACE "${RE}" "\\1" LNAME "${LNAME}" )
- if(LNAME MATCHES ".*hl")
- list(APPEND ${libraries_hl} ${LNAME})
- else()
- list(APPEND ${libraries} ${LNAME})
- endif()
- endforeach()
+ if(UNIX)
+ separate_arguments(_HDF5_COMPILE_ARGS UNIX_COMMAND "${${compile_line_var}}")
+ else()
+ separate_arguments(_HDF5_COMPILE_ARGS WINDOWS_COMMAND "${${compile_line_var}}")
+ endif()
- # now search for full library paths with no flags
- set( RE " ([^\" ]+|\"[^\"]+\")")
- string( REGEX MATCHALL "${RE}" library_name_noflags "${${compile_line_var}}")
- foreach( LIB IN LISTS library_name_noflags )
- string( REGEX REPLACE "${RE}" "\\1" LIB "${LIB}" )
- get_filename_component(LIB "${LIB}" ABSOLUTE)
- if(NOT EXISTS ${LIB} OR IS_DIRECTORY ${LIB})
- continue()
- endif()
- get_filename_component(LPATH ${LIB} DIRECTORY)
- get_filename_component(LNAME ${LIB} NAME_WE)
- string( REGEX REPLACE "^lib" "" LNAME ${LNAME} )
- list( APPEND ${library_paths} ${LPATH} )
- if(LNAME MATCHES ".*hl")
- list(APPEND ${libraries_hl} ${LNAME})
- else()
- list(APPEND ${libraries} ${LNAME})
- endif()
- endforeach()
+ foreach(arg IN LISTS _HDF5_COMPILE_ARGS)
+ if("${arg}" MATCHES "^-I(.*)$")
+ # include directory
+ list(APPEND ${include_paths} "${CMAKE_MATCH_1}")
+ elseif("${arg}" MATCHES "^-D(.*)$")
+ # compile definition
+ list(APPEND ${definitions} "${CMAKE_MATCH_1}")
+ elseif("${arg}" MATCHES "^-L(.*)$")
+ # library search path
+ list(APPEND ${library_paths} "${CMAKE_MATCH_1}")
+ elseif("${arg}" MATCHES "^-l(hdf5.*hl.*)$")
+ # library name (hl)
+ list(APPEND ${libraries_hl} "${CMAKE_MATCH_1}")
+ elseif("${arg}" MATCHES "^-l(.*)$")
+ # library name
+ list(APPEND ${libraries} "${CMAKE_MATCH_1}")
+ elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.(a|so|dylib|sl|lib)$")
+ # library file
+ if(NOT EXISTS "${arg}")
+ continue()
+ endif()
+ get_filename_component(_HDF5_LPATH "${arg}" DIRECTORY)
+ get_filename_component(_HDF5_LNAME "${arg}" NAME_WE)
+ string(REGEX REPLACE "^lib" "" _HDF5_LNAME "${_HDF5_LNAME}")
+ list(APPEND ${library_paths} "${_HDF5_LPATH}")
+ if(_HDF5_LNAME MATCHES "hdf5.*hl")
+ list(APPEND ${libraries_hl} "${_HDF5_LNAME}")
+ else()
+ list(APPEND ${libraries} "${_HDF5_LNAME}")
+ endif()
+ endif()
+ endforeach()
endmacro()
if(NOT HDF5_ROOT)
set(HDF5_ROOT $ENV{HDF5_ROOT})
endif()
+if(HDF5_ROOT)
+ set(_HDF5_SEARCH_OPTS NO_DEFAULT_PATH)
+else()
+ set(_HDF5_SEARCH_OPTS)
+endif()
# Try to find HDF5 using an installed hdf5-config.cmake
-if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
- find_package(HDF5 QUIET NO_MODULE)
+if(NOT HDF5_FOUND)
+ find_package(HDF5 QUIET NO_MODULE
+ HINTS ${HDF5_ROOT}
+ ${_HDF5_SEARCH_OPTS}
+ )
if( HDF5_FOUND)
set(HDF5_IS_PARALLEL ${HDF5_ENABLE_PARALLEL})
set(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR})
@@ -439,8 +429,8 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
set(HDF5_${_lang}_LIBRARY ${_lang_location} CACHE PATH
"HDF5 ${_lang} library" )
mark_as_advanced(HDF5_${_lang}_LIBRARY)
- list(APPEND HDF5_LIBRARIES ${HDF5_${_lang}_LIBRARY})
- set(HDF5_${_lang}_LIBRARIES ${HDF5_${_lang}_LIBRARY})
+ list(APPEND HDF5_LIBRARIES ${HDF5_${_lang}_TARGET}${_suffix})
+ set(HDF5_${_lang}_LIBRARIES ${HDF5_${_lang}_TARGET}${_suffix})
set(HDF5_${_lang}_FOUND True)
endif()
if(FIND_HL)
@@ -449,8 +439,8 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
set(HDF5_${_lang}_HL_LIBRARY ${_lang_hl_location} CACHE PATH
"HDF5 ${_lang} HL library" )
mark_as_advanced(HDF5_${_lang}_HL_LIBRARY)
- list(APPEND HDF5_HL_LIBRARIES ${HDF5_${_lang}_HL_LIBRARY})
- set(HDF5_${_lang}_HL_LIBRARIES ${HDF5_${_lang}_HL_LIBRARY})
+ list(APPEND HDF5_HL_LIBRARIES ${HDF5_${_lang}_TARGET}${_suffix})
+ set(HDF5_${_lang}_HL_LIBRARIES ${HDF5_${_lang}_TARGET}${_suffix})
set(HDF5_HL_FOUND True)
endif()
endif()
@@ -458,7 +448,7 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
endif()
endif()
-if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
+if(NOT HDF5_FOUND)
set(_HDF5_NEED_TO_SEARCH False)
set(HDF5_COMPILER_NO_INTERROGATE True)
# Only search for languages we've enabled
@@ -506,8 +496,10 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
# search options with the wrapper
find_program(HDF5_${__lang}_COMPILER_EXECUTABLE
NAMES ${HDF5_${__lang}_COMPILER_NAMES} NAMES_PER_DIR
+ HINTS ${HDF5_ROOT}
PATH_SUFFIXES bin Bin
DOC "HDF5 ${__lang} Wrapper compiler. Used only to detect HDF5 compile flags."
+ ${_HDF5_SEARCH_OPTS}
)
mark_as_advanced( HDF5_${__lang}_COMPILER_EXECUTABLE )
unset(HDF5_${__lang}_COMPILER_NAMES)
@@ -526,15 +518,26 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
)
set(HDF5_${__lang}_LIBRARIES)
- set(_HDF5_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
- if(HDF5_USE_STATIC_LIBRARIES)
- set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
- else()
- set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX})
- endif()
-
foreach(L IN LISTS HDF5_${__lang}_LIBRARY_NAMES)
- find_library(HDF5_${__lang}_LIBRARY_${L} ${L} ${HDF5_${__lang}_LIBRARY_DIRS})
+ set(_HDF5_SEARCH_NAMES_LOCAL)
+ if(x"${L}" MATCHES "hdf5")
+ # hdf5 library
+ set(_HDF5_SEARCH_OPTS_LOCAL ${_HDF5_SEARCH_OPTS})
+ if(UNIX AND HDF5_USE_STATIC_LIBRARIES)
+ set(_HDF5_SEARCH_NAMES_LOCAL lib${L}.a)
+ endif()
+ else()
+ # external library
+ set(_HDF5_SEARCH_OPTS_LOCAL)
+ endif()
+ find_library(HDF5_${__lang}_LIBRARY_${L}
+ NAMES ${_HDF5_SEARCH_NAMES_LOCAL} ${L} NAMES_PER_DIR
+ HINTS ${HDF5_${__lang}_LIBRARY_DIRS}
+ ${HDF5_ROOT}
+ ${_HDF5_SEARCH_OPTS_LOCAL}
+ )
+ unset(_HDF5_SEARCH_OPTS_LOCAL)
+ unset(_HDF5_SEARCH_NAMES_LOCAL)
if(HDF5_${__lang}_LIBRARY_${L})
list(APPEND HDF5_${__lang}_LIBRARIES ${HDF5_${__lang}_LIBRARY_${L}})
else()
@@ -544,7 +547,25 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
if(FIND_HL)
set(HDF5_${__lang}_HL_LIBRARIES)
foreach(L IN LISTS HDF5_${__lang}_HL_LIBRARY_NAMES)
- find_library(HDF5_${__lang}_LIBRARY_${L} ${L} ${HDF5_${__lang}_LIBRARY_DIRS})
+ set(_HDF5_SEARCH_NAMES_LOCAL)
+ if("x${L}" MATCHES "hdf5")
+ # hdf5 library
+ set(_HDF5_SEARCH_OPTS_LOCAL ${_HDF5_SEARCH_OPTS})
+ if(UNIX AND HDF5_USE_STATIC_LIBRARIES)
+ set(_HDF5_SEARCH_NAMES_LOCAL lib${L}.a)
+ endif()
+ else()
+ # external library
+ set(_HDF5_SEARCH_OPTS_LOCAL)
+ endif()
+ find_library(HDF5_${__lang}_LIBRARY_${L}
+ NAMES ${_HDF5_SEARCH_NAMES_LOCAL} ${L} NAMES_PER_DIR
+ HINTS ${HDF5_${__lang}_LIBRARY_DIRS}
+ ${HDF5_ROOT}
+ ${_HDF5_SEARCH_OPTS_LOCAL}
+ )
+ unset(_HDF5_SEARCH_OPTS_LOCAL)
+ unset(_HDF5_SEARCH_NAMES_LOCAL)
if(HDF5_${__lang}_LIBRARY_${L})
list(APPEND HDF5_${__lang}_HL_LIBRARIES ${HDF5_${__lang}_LIBRARY_${L}})
else()
@@ -554,8 +575,6 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
set(HDF5_HL_FOUND True)
endif()
- set(CMAKE_FIND_LIBRARY_SUFFIXES ${_HDF5_CMAKE_FIND_LIBRARY_SUFFIXES})
-
set(HDF5_${__lang}_FOUND True)
mark_as_advanced(HDF5_${__lang}_DEFINITIONS)
mark_as_advanced(HDF5_${__lang}_INCLUDE_DIRS)
@@ -626,14 +645,11 @@ elseif(NOT HDF5_FOUND AND NOT _HDF5_NEED_TO_SEARCH)
endif()
endif()
-if(HDF5_ROOT)
- set(SEARCH_OPTS NO_DEFAULT_PATH)
-endif()
find_program( HDF5_DIFF_EXECUTABLE
NAMES h5diff
HINTS ${HDF5_ROOT}
PATH_SUFFIXES bin Bin
- ${SEARCH_OPTS}
+ ${_HDF5_SEARCH_OPTS}
DOC "HDF5 file differencing tool." )
mark_as_advanced( HDF5_DIFF_EXECUTABLE )
@@ -650,9 +666,9 @@ if( NOT HDF5_FOUND )
foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS)
# find the HDF5 include directories
- if(LANGUAGE STREQUAL "Fortran")
+ if("${__lang}" STREQUAL "Fortran")
set(HDF5_INCLUDE_FILENAME hdf5.mod)
- elseif(LANGUAGE STREQUAL "CXX")
+ elseif("${__lang}" STREQUAL "CXX")
set(HDF5_INCLUDE_FILENAME H5Cpp.h)
else()
set(HDF5_INCLUDE_FILENAME hdf5.h)
@@ -662,9 +678,9 @@ if( NOT HDF5_FOUND )
HINTS ${HDF5_ROOT}
PATHS $ENV{HOME}/.local/include
PATH_SUFFIXES include Include
- ${SEARCH_OPTS}
+ ${_HDF5_SEARCH_OPTS}
)
- mark_as_advanced(HDF5_${LANGUAGE}_INCLUDE_DIR)
+ mark_as_advanced(HDF5_${__lang}_INCLUDE_DIR)
list(APPEND HDF5_INCLUDE_DIRS ${HDF5_${__lang}_INCLUDE_DIR})
# find the HDF5 libraries
@@ -686,12 +702,12 @@ if( NOT HDF5_FOUND )
find_library(HDF5_${LIB}_LIBRARY_DEBUG
NAMES ${THIS_LIBRARY_SEARCH_DEBUG}
HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib
- ${SEARCH_OPTS}
+ ${_HDF5_SEARCH_OPTS}
)
find_library( HDF5_${LIB}_LIBRARY_RELEASE
NAMES ${THIS_LIBRARY_SEARCH_RELEASE}
HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib
- ${SEARCH_OPTS}
+ ${_HDF5_SEARCH_OPTS}
)
select_library_configurations( HDF5_${LIB} )
list(APPEND HDF5_${__lang}_LIBRARIES ${HDF5_${LIB}_LIBRARY})
@@ -723,12 +739,12 @@ if( NOT HDF5_FOUND )
find_library(HDF5_${LIB}_LIBRARY_DEBUG
NAMES ${THIS_LIBRARY_SEARCH_DEBUG}
HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib
- ${SEARCH_OPTS}
+ ${_HDF5_SEARCH_OPTS}
)
find_library( HDF5_${LIB}_LIBRARY_RELEASE
NAMES ${THIS_LIBRARY_SEARCH_RELEASE}
HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib
- ${SEARCH_OPTS}
+ ${_HDF5_SEARCH_OPTS}
)
select_library_configurations( HDF5_${LIB} )
list(APPEND HDF5_${__lang}_HL_LIBRARIES ${HDF5_${LIB}_LIBRARY})
@@ -780,17 +796,18 @@ if( NOT HDF5_FOUND )
"HDF5 library compiled with parallel IO support" )
mark_as_advanced( HDF5_IS_PARALLEL )
- # For backwards compatibility we set HDF5_INCLUDE_DIR to the value of
- # HDF5_INCLUDE_DIRS
- if( HDF5_INCLUDE_DIRS )
- set( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" )
- endif()
set(HDF5_REQUIRED_VARS HDF5_LIBRARIES HDF5_INCLUDE_DIRS)
if(FIND_HL)
list(APPEND HDF5_REQUIRED_VARS HDF5_HL_LIBRARIES)
endif()
endif()
+# For backwards compatibility we set HDF5_INCLUDE_DIR to the value of
+# HDF5_INCLUDE_DIRS
+if( HDF5_INCLUDE_DIRS )
+ set( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" )
+endif()
+
# If HDF5_REQUIRED_VARS is empty at this point, then it's likely that
# something external is trying to explicitly pass already found
# locations
@@ -803,3 +820,5 @@ find_package_handle_standard_args(HDF5
VERSION_VAR HDF5_VERSION
HANDLE_COMPONENTS
)
+
+unset(_HDF5_SEARCH_OPTS)
diff --git a/Modules/FindHSPELL.cmake b/Modules/FindHSPELL.cmake
index 72d70ad..bb0e2f0 100644
--- a/Modules/FindHSPELL.cmake
+++ b/Modules/FindHSPELL.cmake
@@ -36,12 +36,9 @@ if (HSPELL_INCLUDE_DIR)
unset(HSPELL_H)
endif()
-# handle the QUIETLY and REQUIRED arguments and set HSPELL_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(HSPELL
REQUIRED_VARS HSPELL_LIBRARIES HSPELL_INCLUDE_DIR
VERSION_VAR HSPELL_VERSION_STRING)
mark_as_advanced(HSPELL_INCLUDE_DIR HSPELL_LIBRARIES)
-
diff --git a/Modules/FindHg.cmake b/Modules/FindHg.cmake
index ef85abc..8aa553e 100644
--- a/Modules/FindHg.cmake
+++ b/Modules/FindHg.cmake
@@ -90,8 +90,6 @@ if(HG_EXECUTABLE)
endmacro(HG_WC_INFO)
endif()
-# Handle the QUIETLY and REQUIRED arguments and set HG_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(Hg
REQUIRED_VARS HG_EXECUTABLE
diff --git a/Modules/FindICU.cmake b/Modules/FindICU.cmake
index 36dd67e..5210f08 100644
--- a/Modules/FindICU.cmake
+++ b/Modules/FindICU.cmake
@@ -126,6 +126,7 @@ function(_ICU_FIND)
# Generic 64-bit and 32-bit directories
list(APPEND icu_binary_suffixes "${_bin64}" "bin")
list(APPEND icu_library_suffixes "${_lib64}" "lib")
+ list(APPEND icu_include_suffixes "include")
# Find all ICU programs
foreach(program ${icu_programs})
diff --git a/Modules/FindIcotool.cmake b/Modules/FindIcotool.cmake
index bd3e327..26e95a0 100644
--- a/Modules/FindIcotool.cmake
+++ b/Modules/FindIcotool.cmake
@@ -39,8 +39,6 @@ if(ICOTOOL_EXECUTABLE)
unset(_icotool_version)
endif()
-# handle the QUIETLY and REQUIRED arguments and set ICOTOOL_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
Icotool
diff --git a/Modules/FindJPEG.cmake b/Modules/FindJPEG.cmake
index b644181..e233714 100644
--- a/Modules/FindJPEG.cmake
+++ b/Modules/FindJPEG.cmake
@@ -26,8 +26,6 @@ find_path(JPEG_INCLUDE_DIR jpeglib.h)
set(JPEG_NAMES ${JPEG_NAMES} jpeg libjpeg)
find_library(JPEG_LIBRARY NAMES ${JPEG_NAMES} )
-# handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(JPEG DEFAULT_MSG JPEG_LIBRARY JPEG_INCLUDE_DIR)
diff --git a/Modules/FindJasper.cmake b/Modules/FindJasper.cmake
index 748510e..db76657 100644
--- a/Modules/FindJasper.cmake
+++ b/Modules/FindJasper.cmake
@@ -34,8 +34,6 @@ if (JASPER_INCLUDE_DIR AND EXISTS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h")
string(REGEX REPLACE "^#define[\t ]+JAS_VERSION[\t ]+\"([^\"]+)\".*" "\\1" JASPER_VERSION_STRING "${jasper_version_str}")
endif ()
-# handle the QUIETLY and REQUIRED arguments and set JASPER_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Jasper
REQUIRED_VARS JASPER_LIBRARIES JASPER_INCLUDE_DIR JPEG_LIBRARIES
diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake
index e30917d..4265a97 100644
--- a/Modules/FindJava.cmake
+++ b/Modules/FindJava.cmake
@@ -86,6 +86,14 @@ list(APPEND _JAVA_HINTS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.5;JavaHome]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Runtime Environment\\2.0;JavaHome]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Runtime Environment\\1.9;JavaHome]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Runtime Environment\\1.8;JavaHome]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Runtime Environment\\1.7;JavaHome]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Runtime Environment\\2.6;JavaHome]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Runtime Environment\\1.5;JavaHome]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Runtime Environment\\1.4;JavaHome]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Runtime Environment\\1.3;JavaHome]/bin"
)
# Hard-coded guesses should still go in PATHS. This ensures that the user
# environment can always override hard guesses.
@@ -262,4 +270,3 @@ mark_as_advanced(
set(JAVA_RUNTIME ${Java_JAVA_EXECUTABLE})
set(JAVA_ARCHIVE ${Java_JAR_EXECUTABLE})
set(JAVA_COMPILE ${Java_JAVAC_EXECUTABLE})
-
diff --git a/Modules/FindLATEX.cmake b/Modules/FindLATEX.cmake
index 1d8f6ce..d1f4fa4 100644
--- a/Modules/FindLATEX.cmake
+++ b/Modules/FindLATEX.cmake
@@ -271,7 +271,6 @@ mark_as_advanced(
HTLATEX_COMPILER
)
-# handle variables for found Latex and its components
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(LATEX
REQUIRED_VARS LATEX_COMPILER
diff --git a/Modules/FindLTTngUST.cmake b/Modules/FindLTTngUST.cmake
index 8781bae..00d5e7a 100644
--- a/Modules/FindLTTngUST.cmake
+++ b/Modules/FindLTTngUST.cmake
@@ -90,8 +90,6 @@ if(LTTNGUST_INCLUDE_DIRS AND LTTNGUST_LIBRARIES)
set(LTTNGUST_LIBRARIES ${LTTNGUST_LIBRARIES} ${CMAKE_DL_LIBS})
endif()
-# handle the QUIETLY and REQUIRED arguments and set LTTNGUST_FOUND to
-# TRUE if all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(LTTngUST FOUND_VAR LTTNGUST_FOUND
REQUIRED_VARS LTTNGUST_LIBRARIES
diff --git a/Modules/FindLibArchive.cmake b/Modules/FindLibArchive.cmake
index 1a26bbb..38e512f 100644
--- a/Modules/FindLibArchive.cmake
+++ b/Modules/FindLibArchive.cmake
@@ -46,17 +46,11 @@ if(LibArchive_INCLUDE_DIR AND EXISTS "${LibArchive_INCLUDE_DIR}/archive.h")
unset(_LibArchive_VERSION_STRING)
endif()
-# Handle the QUIETLY and REQUIRED arguments and set LIBARCHIVE_FOUND
-# to TRUE if all listed variables are TRUE.
-# (Use ${CMAKE_ROOT}/Modules instead of ${CMAKE_CURRENT_LIST_DIR} because CMake
-# itself includes this FindLibArchive when built with an older CMake that does
-# not provide it. The older CMake also does not have CMAKE_CURRENT_LIST_DIR.)
-include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(LibArchive
REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR
VERSION_VAR LibArchive_VERSION
)
-set(LibArchive_FOUND ${LIBARCHIVE_FOUND})
unset(LIBARCHIVE_FOUND)
if(LibArchive_FOUND)
diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake
index 9580981..613f927 100644
--- a/Modules/FindLibXml2.cmake
+++ b/Modules/FindLibXml2.cmake
@@ -52,8 +52,6 @@ elseif(LIBXML2_INCLUDE_DIR AND EXISTS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.
unset(libxml2_version_str)
endif()
-# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2
REQUIRED_VARS LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR
diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake
index 5be0428..b59b9b3 100644
--- a/Modules/FindLua.cmake
+++ b/Modules/FindLua.cmake
@@ -75,16 +75,9 @@ function(_lua_set_version_vars)
include/lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
include/lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
)
- list(APPEND _lua_library_names
- lua${CMAKE_MATCH_1}${CMAKE_MATCH_2}
- lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
- lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
- lua.${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
- )
endforeach ()
set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE)
- set(_lua_library_names "${_lua_library_names}" PARENT_SCOPE)
set(_lua_append_versions "${_lua_append_versions}" PARENT_SCOPE)
endfunction(_lua_set_version_vars)
@@ -152,6 +145,15 @@ endif ()
unset(_lua_include_subdirs)
unset(_lua_append_versions)
+if (LUA_VERSION_STRING)
+ set(_lua_library_names
+ lua${LUA_VERSION_MAJOR}${LUA_VERSION_MINOR}
+ lua${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}
+ lua-${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}
+ lua.${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}
+ )
+endif ()
+
find_library(LUA_LIBRARY
NAMES ${_lua_library_names} lua
HINTS
@@ -172,6 +174,13 @@ if (LUA_LIBRARY)
if (UNIX AND NOT APPLE AND NOT BEOS)
find_library(LUA_MATH_LIBRARY m)
set(LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}")
+
+ # include dl library for statically-linked Lua library
+ get_filename_component(LUA_LIB_EXT ${LUA_LIBRARY} EXT)
+ if(LUA_LIB_EXT STREQUAL CMAKE_STATIC_LIBRARY_SUFFIX)
+ list(APPEND LUA_LIBRARIES ${CMAKE_DL_LIBS})
+ endif()
+
# For Windows and Mac, don't need to explicitly include the math library
else ()
set(LUA_LIBRARIES "${LUA_LIBRARY}")
diff --git a/Modules/FindMPEG.cmake b/Modules/FindMPEG.cmake
index aff464e..cd1b021 100644
--- a/Modules/FindMPEG.cmake
+++ b/Modules/FindMPEG.cmake
@@ -34,8 +34,6 @@ find_library( MPEG_vo_LIBRARY vo
/usr/local/livid/mpeg2dec/libvo/.libs
)
-# handle the QUIETLY and REQUIRED arguments and set MPEG2_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG DEFAULT_MSG MPEG_INCLUDE_DIR MPEG_mpeg2_LIBRARY MPEG_vo_LIBRARY)
diff --git a/Modules/FindMPEG2.cmake b/Modules/FindMPEG2.cmake
index e28054d..2c75d7b 100644
--- a/Modules/FindMPEG2.cmake
+++ b/Modules/FindMPEG2.cmake
@@ -35,9 +35,6 @@ find_library( MPEG2_vo_LIBRARY vo
/usr/local/livid/mpeg2dec/libvo/.libs
)
-
-# handle the QUIETLY and REQUIRED arguments and set MPEG2_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG2 DEFAULT_MSG MPEG2_mpeg2_LIBRARY MPEG2_INCLUDE_DIR)
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index 676e1bc..ff2c4de 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -91,7 +91,6 @@
#
# In new projects, please use the ``MPI_<lang>_XXX`` equivalents.
-# include this to handle the QUIETLY and REQUIRED arguments
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
#
@@ -114,9 +113,10 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
#
# Start out with the generic MPI compiler names, as these are most commonly used.
-set(_MPI_C_COMPILER_NAMES mpicc mpcc mpicc_r mpcc_r)
+set(_MPI_C_COMPILER_NAMES mpicc mpcc mpicc_r mpcc_r mpicc.bat)
set(_MPI_CXX_COMPILER_NAMES mpicxx mpiCC mpcxx mpCC mpic++ mpc++
- mpicxx_r mpiCC_r mpcxx_r mpCC_r mpic++_r mpc++_r)
+ mpicxx_r mpiCC_r mpcxx_r mpCC_r mpic++_r mpc++_r
+ mpicxx.bat)
set(_MPI_Fortran_COMPILER_NAMES mpif95 mpif95_r mpf95 mpf95_r
mpif90 mpif90_r mpf90 mpf90_r
mpif77 mpif77_r mpf77 mpf77_r)
@@ -128,9 +128,9 @@ set(_MPI_GNU_Fortran_COMPILER_NAMES mpigfortran mpgfortran mpigfortran_r
mpig77 mpig77_r mpg77 mpg77_r)
# Intel MPI compiler names
-set(_MPI_Intel_C_COMPILER_NAMES mpiicc)
-set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc mpiicxx mpiic++ mpiiCC)
-set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort mpiif95 mpiif90 mpiif77)
+set(_MPI_Intel_C_COMPILER_NAMES mpiicc mpiicc.bat)
+set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc mpiicxx mpiic++ mpiiCC mpiicpc.bat)
+set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort mpiif95 mpiif90 mpiif77 mpiifort.bat)
# PGI compiler names
set(_MPI_PGI_C_COMPILER_NAMES mpipgcc mppgcc)
@@ -314,6 +314,7 @@ function (interrogate_mpi_compiler lang try_libs)
set(MPI_COMPILE_FLAGS_WORK)
foreach(FLAG ${MPI_ALL_COMPILE_FLAGS})
+ string(REGEX REPLACE "^ " "" FLAG ${FLAG})
if (MPI_COMPILE_FLAGS_WORK)
string(APPEND MPI_COMPILE_FLAGS_WORK " ${FLAG}")
else()
@@ -323,9 +324,13 @@ function (interrogate_mpi_compiler lang try_libs)
# Extract include paths from compile command line
string(REGEX MATCHALL "(^| )-I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}")
+ set(MPI_INCLUDE_PATH_WORK)
+
foreach(IPATH ${MPI_ALL_INCLUDE_PATHS})
string(REGEX REPLACE "^ ?-I" "" IPATH ${IPATH})
string(REPLACE "//" "/" IPATH ${IPATH})
+ string(REPLACE "\"" "" IPATH ${IPATH})
+ file(TO_CMAKE_PATH "${IPATH}" IPATH)
list(APPEND MPI_INCLUDE_PATH_WORK ${IPATH})
endforeach()
@@ -363,6 +368,7 @@ function (interrogate_mpi_compiler lang try_libs)
string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker )([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}")
set(MPI_LINK_FLAGS_WORK)
foreach(FLAG ${MPI_ALL_LINK_FLAGS})
+ string(REGEX REPLACE "^ " "" FLAG ${FLAG})
if (MPI_LINK_FLAGS_WORK)
string(APPEND MPI_LINK_FLAGS_WORK " ${FLAG}")
else()
diff --git a/Modules/FindMotif.cmake b/Modules/FindMotif.cmake
index 3923238..7304d95 100644
--- a/Modules/FindMotif.cmake
+++ b/Modules/FindMotif.cmake
@@ -30,12 +30,9 @@ if(UNIX)
endif()
-# handle the QUIETLY and REQUIRED arguments and set MOTIF_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Motif DEFAULT_MSG MOTIF_LIBRARIES MOTIF_INCLUDE_DIR)
-
mark_as_advanced(
MOTIF_INCLUDE_DIR
MOTIF_LIBRARIES
diff --git a/Modules/FindOpenAL.cmake b/Modules/FindOpenAL.cmake
index 1abb0d6..8622b4c 100644
--- a/Modules/FindOpenAL.cmake
+++ b/Modules/FindOpenAL.cmake
@@ -92,8 +92,6 @@ find_library(OPENAL_LIBRARY
unset(_OpenAL_ARCH_DIR)
-# handle the QUIETLY and REQUIRED arguments and set OPENAL_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenAL DEFAULT_MSG OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake
index e487726..503d955 100644
--- a/Modules/FindOpenGL.cmake
+++ b/Modules/FindOpenGL.cmake
@@ -7,6 +7,16 @@
#
# FindModule for OpenGL and GLU.
#
+# IMPORTED Targets
+# ^^^^^^^^^^^^^^^^
+#
+# This module defines the :prop_tgt:`IMPORTED` targets:
+#
+# ``OpenGL::GL``
+# Defined if the system has OpenGL.
+# ``OpenGL::GLU``
+# Defined if the system has GLU.
+#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
@@ -156,12 +166,59 @@ endif()
# This deprecated setting is for backward compatibility with CMake1.4
set(OPENGL_INCLUDE_PATH ${OPENGL_INCLUDE_DIR})
-# handle the QUIETLY and REQUIRED arguments and set OPENGL_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGL REQUIRED_VARS ${_OpenGL_REQUIRED_VARS})
unset(_OpenGL_REQUIRED_VARS)
+# OpenGL:: targets
+if(OPENGL_FOUND)
+ if(NOT TARGET OpenGL::GL)
+ if(IS_ABSOLUTE "${OPENGL_gl_LIBRARY}")
+ add_library(OpenGL::GL UNKNOWN IMPORTED)
+ if(OPENGL_gl_LIBRARY MATCHES "/([^/]+)\\.framework$")
+ set(_gl_fw "${OPENGL_gl_LIBRARY}/${CMAKE_MATCH_1}")
+ if(EXISTS "${_gl_fw}.tbd")
+ set(_gl_fw "${_gl_fw}.tbd")
+ endif()
+ set_target_properties(OpenGL::GL PROPERTIES
+ IMPORTED_LOCATION "${_gl_fw}")
+ else()
+ set_target_properties(OpenGL::GL PROPERTIES
+ IMPORTED_LOCATION "${OPENGL_gl_LIBRARY}")
+ endif()
+ else()
+ add_library(OpenGL::GL INTERFACE IMPORTED)
+ set_target_properties(OpenGL::GL PROPERTIES
+ IMPORTED_LIBNAME "${OPENGL_gl_LIBRARY}")
+ endif()
+ set_target_properties(OpenGL::GL PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}")
+ endif()
+
+ if(OPENGL_GLU_FOUND AND NOT TARGET OpenGL::GLU)
+ if(IS_ABSOLUTE "${OPENGL_glu_LIBRARY}")
+ add_library(OpenGL::GLU UNKNOWN IMPORTED)
+ if(OPENGL_glu_LIBRARY MATCHES "/([^/]+)\\.framework$")
+ set(_glu_fw "${OPENGL_glu_LIBRARY}/${CMAKE_MATCH_1}")
+ if(EXISTS "${_glu_fw}.tbd")
+ set(_glu_fw "${_glu_fw}.tbd")
+ endif()
+ set_target_properties(OpenGL::GLU PROPERTIES
+ IMPORTED_LOCATION "${_glu_fw}")
+ else()
+ set_target_properties(OpenGL::GLU PROPERTIES
+ IMPORTED_LOCATION "${OPENGL_glu_LIBRARY}")
+ endif()
+ else()
+ add_library(OpenGL::GLU INTERFACE IMPORTED)
+ set_target_properties(OpenGL::GLU PROPERTIES
+ IMPORTED_LIBNAME "${OPENGL_glu_LIBRARY}")
+ endif()
+ set_target_properties(OpenGL::GLU PROPERTIES
+ INTERFACE_LINK_LIBRARIES OpenGL::GL)
+ endif()
+endif()
+
mark_as_advanced(
OPENGL_INCLUDE_DIR
OPENGL_xmesa_INCLUDE_DIR
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index 30fc5c6..6259ce1 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -204,7 +204,6 @@ if(WIN32 AND NOT CYGWIN)
SSL_EAY_LIBRARY_DEBUG SSL_EAY_LIBRARY_RELEASE)
set(OPENSSL_SSL_LIBRARY ${SSL_EAY_LIBRARY} )
set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY_LIBRARY} )
- set(OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY} )
elseif(MINGW)
# same player, for MinGW
set(LIB_EAY_NAMES crypto libeay32)
@@ -232,7 +231,6 @@ if(WIN32 AND NOT CYGWIN)
mark_as_advanced(SSL_EAY LIB_EAY)
set(OPENSSL_SSL_LIBRARY ${SSL_EAY} )
set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY} )
- set(OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} )
unset(LIB_EAY_NAMES)
unset(SSL_EAY_NAMES)
else()
@@ -264,7 +262,6 @@ if(WIN32 AND NOT CYGWIN)
mark_as_advanced(SSL_EAY LIB_EAY)
set(OPENSSL_SSL_LIBRARY ${SSL_EAY} )
set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY} )
- set(OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} )
endif()
else()
@@ -298,8 +295,6 @@ else()
set(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY})
set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
- set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})
-
endif()
function(from_hex HEX DEC)
@@ -371,10 +366,13 @@ endif ()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} )
+
if (OPENSSL_VERSION)
find_package_handle_standard_args(OpenSSL
REQUIRED_VARS
- OPENSSL_LIBRARIES
+ OPENSSL_SSL_LIBRARY
+ OPENSSL_CRYPTO_LIBRARY
OPENSSL_INCLUDE_DIR
VERSION_VAR
OPENSSL_VERSION
@@ -383,7 +381,8 @@ if (OPENSSL_VERSION)
)
else ()
find_package_handle_standard_args(OpenSSL "Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR"
- OPENSSL_LIBRARIES
+ OPENSSL_SSL_LIBRARY
+ OPENSSL_CRYPTO_LIBRARY
OPENSSL_INCLUDE_DIR
)
endif ()
diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake
index af873fa..425aa45 100644
--- a/Modules/FindOpenSceneGraph.cmake
+++ b/Modules/FindOpenSceneGraph.cmake
@@ -227,4 +227,3 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenSceneGraph
unset(_osg_component_founds)
set(OPENSCENEGRAPH_INCLUDE_DIRS ${OPENSCENEGRAPH_INCLUDE_DIR})
-
diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake
index 6f94d50..dceb6bc 100644
--- a/Modules/FindPNG.cmake
+++ b/Modules/FindPNG.cmake
@@ -25,7 +25,7 @@
# ``PNG_LIBRARIES``
# the libraries to link against to use PNG.
# ``PNG_DEFINITIONS``
-# You should add_definitons(${PNG_DEFINITIONS}) before compiling code
+# You should add_definitions(${PNG_DEFINITIONS}) before compiling code
# that includes png library files.
# ``PNG_FOUND``
# If false, do not try to use PNG.
@@ -140,8 +140,6 @@ if(ZLIB_FOUND)
endif ()
endif()
-# handle the QUIETLY and REQUIRED arguments and set PNG_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(PNG
REQUIRED_VARS PNG_LIBRARY PNG_PNG_INCLUDE_DIR
diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake
index 7b46877..b77925d 100644
--- a/Modules/FindPackageHandleStandardArgs.cmake
+++ b/Modules/FindPackageHandleStandardArgs.cmake
@@ -130,7 +130,6 @@ message.
#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake)
-include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
# internal helper macro
macro(_FPHSA_FAILURE_MESSAGE _msg)
diff --git a/Modules/FindPerl.cmake b/Modules/FindPerl.cmake
index a0c8a33..423fc69 100644
--- a/Modules/FindPerl.cmake
+++ b/Modules/FindPerl.cmake
@@ -70,8 +70,6 @@ endif()
# Deprecated settings for compatibility with CMake1.4
set(PERL ${PERL_EXECUTABLE})
-# handle the QUIETLY and REQUIRED arguments and set PERL_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Perl
REQUIRED_VARS PERL_EXECUTABLE
diff --git a/Modules/FindPerlLibs.cmake b/Modules/FindPerlLibs.cmake
index 42729d7..e01e75e 100644
--- a/Modules/FindPerlLibs.cmake
+++ b/Modules/FindPerlLibs.cmake
@@ -239,8 +239,6 @@ if (PERL_EXECUTABLE)
endif ()
-# handle the QUIETLY and REQUIRED arguments and set PERLLIBS_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(PerlLibs REQUIRED_VARS PERL_LIBRARY PERL_INCLUDE_PATH
VERSION_VAR PERL_VERSION_STRING)
diff --git a/Modules/FindPhysFS.cmake b/Modules/FindPhysFS.cmake
index fe5b397..cfe9b0f 100644
--- a/Modules/FindPhysFS.cmake
+++ b/Modules/FindPhysFS.cmake
@@ -43,8 +43,5 @@ find_library(PHYSFS_LIBRARY
/opt
)
-# handle the QUIETLY and REQUIRED arguments and set PHYSFS_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PhysFS DEFAULT_MSG PHYSFS_LIBRARY PHYSFS_INCLUDE_DIR)
-
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index 3f75b19..1958f4b 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -381,8 +381,9 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma
if (_pkg_check_modules_pkg_op)
list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_ver}")
else()
- list(APPEND _pkg_check_modules_exist_query --exists --print-errors --short-errors)
+ list(APPEND _pkg_check_modules_exist_query --exists)
endif()
+ list(APPEND _pkg_check_modules_exist_query --print-errors --short-errors)
_pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_VERSION)
_pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_PREFIX)
@@ -584,10 +585,13 @@ endmacro()
macro(pkg_check_modules _prefix _module0)
_pkgconfig_parse_options(_pkg_modules _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path _imp_target "${_module0}" ${ARGN})
# check cached value
- if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
+ if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND OR NOT "${__pkg_config_arguments_${_prefix}}" STREQUAL "${_module0};${ARGN}")
_pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target} "${_prefix}" ${_pkg_modules})
_pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
+ if (${_prefix}_FOUND)
+ _pkgconfig_set(__pkg_config_arguments_${_prefix} "${_module0};${ARGN}")
+ endif()
elseif (${_prefix}_FOUND AND ${_imp_target})
_pkg_create_imp_target("${_prefix}" _no_cmake_path _no_cmake_environment_path)
endif()
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index 14e392a..3ffd5a7 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -264,7 +264,7 @@ function(_protobuf_find_libraries name filename)
mark_as_advanced(${name}_LIBRARY_RELEASE)
find_library(${name}_LIBRARY_DEBUG
- NAMES ${filename}
+ NAMES ${filename}d ${filename}
PATHS ${Protobuf_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Debug)
mark_as_advanced(${name}_LIBRARY_DEBUG)
diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake
index 103e820..f255246 100644
--- a/Modules/FindPythonInterp.cmake
+++ b/Modules/FindPythonInterp.cmake
@@ -145,8 +145,6 @@ if(PYTHON_EXECUTABLE)
unset(_VERSION)
endif()
-# handle the QUIETLY and REQUIRED arguments and set PYTHONINTERP_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonInterp REQUIRED_VARS PYTHON_EXECUTABLE VERSION_VAR PYTHON_VERSION_STRING)
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index 1ebbf29..63ec9a8 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -42,16 +42,16 @@
# Use the executable's path as a hint
set(_Python_LIBRARY_PATH_HINT)
-if(PYTHON_EXECUTABLE)
+if(IS_ABSOLUTE "${PYTHON_EXECUTABLE}")
if(WIN32)
- get_filename_component(_Python_PREFIX ${PYTHON_EXECUTABLE} PATH)
+ get_filename_component(_Python_PREFIX "${PYTHON_EXECUTABLE}" PATH)
if(_Python_PREFIX)
set(_Python_LIBRARY_PATH_HINT ${_Python_PREFIX}/libs)
endif()
unset(_Python_PREFIX)
else()
- get_filename_component(_Python_PREFIX ${PYTHON_EXECUTABLE} PATH)
- get_filename_component(_Python_PREFIX ${_Python_PREFIX} PATH)
+ get_filename_component(_Python_PREFIX "${PYTHON_EXECUTABLE}" PATH)
+ get_filename_component(_Python_PREFIX "${_Python_PREFIX}" PATH)
if(_Python_PREFIX)
set(_Python_LIBRARY_PATH_HINT ${_Python_PREFIX}/lib)
endif()
@@ -168,12 +168,19 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
# Use the library's install prefix as a hint
set(_Python_INCLUDE_PATH_HINT)
- get_filename_component(_Python_PREFIX ${PYTHON_LIBRARY} PATH)
- get_filename_component(_Python_PREFIX ${_Python_PREFIX} PATH)
- if(_Python_PREFIX)
- set(_Python_INCLUDE_PATH_HINT ${_Python_PREFIX}/include)
- endif()
- unset(_Python_PREFIX)
+ # PYTHON_LIBRARY may contain a list because of SelectLibraryConfigurations
+ # which may have been run previously. If it is the case, the list can be:
+ # optimized;<FILEPATH_TO_RELEASE_LIBRARY>;debug;<FILEPATH_TO_DEBUG_LIBRARY>
+ foreach(lib ${PYTHON_LIBRARY} ${PYTHON_DEBUG_LIBRARY})
+ if(IS_ABSOLUTE "${lib}")
+ get_filename_component(_Python_PREFIX "${lib}" PATH)
+ get_filename_component(_Python_PREFIX "${_Python_PREFIX}" PATH)
+ if(_Python_PREFIX)
+ list(APPEND _Python_INCLUDE_PATH_HINT ${_Python_PREFIX}/include)
+ endif()
+ unset(_Python_PREFIX)
+ endif()
+ endforeach()
# Add framework directories to the search paths
set(PYTHON_FRAMEWORK_INCLUDES)
diff --git a/Modules/FindQuickTime.cmake b/Modules/FindQuickTime.cmake
index 2ee1899..995d882 100644
--- a/Modules/FindQuickTime.cmake
+++ b/Modules/FindQuickTime.cmake
@@ -29,7 +29,5 @@ find_library(QUICKTIME_LIBRARY QuickTime
lib
)
-# handle the QUIETLY and REQUIRED arguments and set QUICKTIME_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(QuickTime DEFAULT_MSG QUICKTIME_LIBRARY QUICKTIME_INCLUDE_DIR)
diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake
index c0cdd98..3410018 100644
--- a/Modules/FindSDL.cmake
+++ b/Modules/FindSDL.cmake
@@ -94,6 +94,11 @@ find_library(SDL_LIBRARY_TEMP
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
)
+# Hide this cache variable from the user, it's an internal implementation
+# detail. The documented library variable for the user is SDL_LIBRARY
+# which is derived from SDL_LIBRARY_TEMP further below.
+set_property(CACHE SDL_LIBRARY_TEMP PROPERTY TYPE INTERNAL)
+
if(NOT SDL_BUILDING_LIBRARY)
if(NOT SDL_INCLUDE_DIR MATCHES ".framework")
# Non-OS X framework versions expect you to also dynamically link to
@@ -122,11 +127,10 @@ if(NOT APPLE)
find_package(Threads)
endif()
-# MinGW needs an additional library, mwindows
-# It's total link flags should look like -lmingw32 -lSDLmain -lSDL -lmwindows
-# (Actually on second look, I think it only needs one of the m* libraries.)
+# MinGW needs an additional link flag, -mwindows
+# It's total link flags should look like -lmingw32 -lSDLmain -lSDL -mwindows
if(MINGW)
- set(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW")
+ set(MINGW32_LIBRARY mingw32 "-mwindows" CACHE STRING "link flags for MinGW")
endif()
if(SDL_LIBRARY_TEMP)
@@ -163,8 +167,6 @@ if(SDL_LIBRARY_TEMP)
# Set the final string here so the GUI reflects the final state.
set(SDL_LIBRARY ${SDL_LIBRARY_TEMP} CACHE STRING "Where the SDL Library can be found")
- # Set the temp variable to INTERNAL so it is not seen in the CMake GUI
- set(SDL_LIBRARY_TEMP "${SDL_LIBRARY_TEMP}" CACHE INTERNAL "")
endif()
if(SDL_INCLUDE_DIR AND EXISTS "${SDL_INCLUDE_DIR}/SDL_version.h")
diff --git a/Modules/FindSDL_sound.cmake b/Modules/FindSDL_sound.cmake
index 3198088..cf33a4c 100644
--- a/Modules/FindSDL_sound.cmake
+++ b/Modules/FindSDL_sound.cmake
@@ -19,7 +19,7 @@
# SDL_SOUND_INCLUDE_DIR, where to find SDL_sound.h
# SDL_SOUND_FOUND, if false, do not try to link to SDL_sound
# SDL_SOUND_LIBRARIES, this contains the list of libraries that you need
-# to link against. This is a read-only variable and is marked INTERNAL.
+# to link against.
# SDL_SOUND_EXTRAS, this is an optional variable for you to add your own
# flags to SDL_SOUND_LIBRARIES. This is prepended to SDL_SOUND_LIBRARIES.
# This is available mostly for cases this module failed to anticipate for
@@ -367,11 +367,10 @@ if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY)
endif()
endif()
+ set(SDL_SOUND_LIBRARIES ${SDL_SOUND_EXTRAS} ${SDL_SOUND_LIBRARIES_TMP})
else()
- set(SDL_SOUND_LIBRARIES "${SDL_SOUND_EXTRAS} ${SDL_SOUND_LIBRARY}" CACHE INTERNAL "SDL_sound and dependent libraries")
+ set(SDL_SOUND_LIBRARIES ${SDL_SOUND_EXTRAS} ${SDL_SOUND_LIBRARY})
endif()
-
- set(SDL_SOUND_LIBRARIES "${SDL_SOUND_EXTRAS} ${SDL_SOUND_LIBRARIES_TMP}" CACHE INTERNAL "SDL_sound and dependent libraries")
endif()
if(SDL_SOUND_INCLUDE_DIR AND EXISTS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h")
diff --git a/Modules/FindSquish.cmake b/Modules/FindSquish.cmake
index 6c8813c..09bdf1f 100644
--- a/Modules/FindSquish.cmake
+++ b/Modules/FindSquish.cmake
@@ -119,9 +119,6 @@
#
# This is deprecated. Use SQUISH_V3_ADD_TEST() if you are using Squish 3.x instead.
-
-include(CMakeParseArguments)
-
set(SQUISH_INSTALL_DIR_STRING "Directory containing the bin, doc, and lib directories for Squish; this should be the root of the installation directory.")
set(SQUISH_SERVER_EXECUTABLE_STRING "The squishserver executable program.")
set(SQUISH_CLIENT_EXECUTABLE_STRING "The squishclient executable program.")
diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake
index 12d6616..b6e24a3 100644
--- a/Modules/FindTCL.cmake
+++ b/Modules/FindTCL.cmake
@@ -205,8 +205,6 @@ find_path(TK_INCLUDE_PATH
HINTS ${TCLTK_POSSIBLE_INCLUDE_PATHS}
)
-# handle the QUIETLY and REQUIRED arguments and set TCL_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TCL DEFAULT_MSG TCL_LIBRARY TCL_INCLUDE_PATH)
diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake
index 23ae308..b622ca6 100644
--- a/Modules/FindTIFF.cmake
+++ b/Modules/FindTIFF.cmake
@@ -65,8 +65,6 @@ if(TIFF_INCLUDE_DIR AND EXISTS "${TIFF_INCLUDE_DIR}/tiffvers.h")
unset(tiff_version_str)
endif()
-# handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF
REQUIRED_VARS TIFF_LIBRARY TIFF_INCLUDE_DIR
diff --git a/Modules/FindTclsh.cmake b/Modules/FindTclsh.cmake
index c8a87ec..9fcb41c 100644
--- a/Modules/FindTclsh.cmake
+++ b/Modules/FindTclsh.cmake
@@ -89,8 +89,6 @@ if(TCL_TCLSH)
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
-# handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Tclsh
REQUIRED_VARS TCL_TCLSH
diff --git a/Modules/FindWget.cmake b/Modules/FindWget.cmake
index 68419e2..4fcb2fa 100644
--- a/Modules/FindWget.cmake
+++ b/Modules/FindWget.cmake
@@ -21,8 +21,6 @@ find_program(WGET_EXECUTABLE
${CYGWIN_INSTALL_PATH}/bin
)
-# handle the QUIETLY and REQUIRED arguments and set WGET_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Wget DEFAULT_MSG WGET_EXECUTABLE)
@@ -30,4 +28,4 @@ mark_as_advanced( WGET_EXECUTABLE )
# WGET option is deprecated.
# use WGET_EXECUTABLE instead.
-set (WGET ${WGET_EXECUTABLE} )
+set (WGET ${WGET_EXECUTABLE})
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake
index 5ee55b3..4065999 100644
--- a/Modules/FindZLIB.cmake
+++ b/Modules/FindZLIB.cmake
@@ -108,8 +108,6 @@ if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
set(ZLIB_PATCH_VERSION "${ZLIB_VERSION_PATCH}")
endif()
-# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_DIR
VERSION_VAR ZLIB_VERSION_STRING)
diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake
index 3899a2d..893a96f 100644
--- a/Modules/FortranCInterface.cmake
+++ b/Modules/FortranCInterface.cmake
@@ -348,7 +348,8 @@ function(FortranCInterface_VERIFY)
try_compile(FortranCInterface_VERIFY_${lang}_COMPILED
${FortranCInterface_BINARY_DIR}/Verify${lang}
${FortranCInterface_SOURCE_DIR}/Verify
- VerifyFortranC
+ VerifyFortranC # project name
+ VerifyFortranC # target name
CMAKE_FLAGS -DVERIFY_CXX=${verify_cxx}
-DCMAKE_VERBOSE_MAKEFILE=ON
"-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}"
diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt
index dee57b5..3a66f68 100644
--- a/Modules/FortranCInterface/CMakeLists.txt
+++ b/Modules/FortranCInterface/CMakeLists.txt
@@ -94,6 +94,9 @@ add_library(myfort STATIC mysub.f my_sub.f ${myfort_modules})
# Provide symbols through C but fall back to Fortran.
add_library(symbols STATIC ${symbol_sources})
target_link_libraries(symbols myfort)
+# In case the Fortran compiler produces PIC by default make sure
+# the C compiler produces PIC even if it is not its default.
+set_property(TARGET symbols PROPERTY POSITION_INDEPENDENT_CODE 1)
# Require symbols through Fortran.
add_executable(FortranCInterface main.F call_sub.f ${call_mod})
diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake
index 9984efd..7612890 100644
--- a/Modules/FortranCInterface/Detect.cmake
+++ b/Modules/FortranCInterface/Detect.cmake
@@ -30,7 +30,8 @@ set(_result)
try_compile(FortranCInterface_COMPILED
${FortranCInterface_BINARY_DIR}
${FortranCInterface_SOURCE_DIR}
- FortranCInterface
+ FortranCInterface # project name
+ FortranCInterface # target name
CMAKE_FLAGS
"-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}"
"-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}"
diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake
index 059a2fc..9599f27 100644
--- a/Modules/GNUInstallDirs.cmake
+++ b/Modules/GNUInstallDirs.cmake
@@ -120,31 +120,54 @@
# allow users who create additional path variables to also compute
# absolute paths where necessary, using the same logic.
-# Installation directories
-#
-if(NOT DEFINED CMAKE_INSTALL_BINDIR)
- set(CMAKE_INSTALL_BINDIR "bin" CACHE PATH "user executables (bin)")
-endif()
+# Convert a cache variable to PATH type
-if(NOT DEFINED CMAKE_INSTALL_SBINDIR)
- set(CMAKE_INSTALL_SBINDIR "sbin" CACHE PATH "system admin executables (sbin)")
-endif()
+macro(_GNUInstallDirs_cache_convert_to_path var description)
+ get_property(_GNUInstallDirs_cache_type CACHE ${var} PROPERTY TYPE)
+ if(_GNUInstallDirs_cache_type STREQUAL "UNINITIALIZED")
+ file(TO_CMAKE_PATH "${${var}}" _GNUInstallDirs_cmakepath)
+ set_property(CACHE ${var} PROPERTY TYPE PATH)
+ set_property(CACHE ${var} PROPERTY VALUE "${_GNUInstallDirs_cmakepath}")
+ set_property(CACHE ${var} PROPERTY HELPSTRING "${description}")
+ unset(_GNUInstallDirs_cmakepath)
+ endif()
+ unset(_GNUInstallDirs_cache_type)
+endmacro()
-if(NOT DEFINED CMAKE_INSTALL_LIBEXECDIR)
- set(CMAKE_INSTALL_LIBEXECDIR "libexec" CACHE PATH "program executables (libexec)")
-endif()
+# Create a cache variable with default for a path.
+macro(_GNUInstallDirs_cache_path var default description)
+ if(NOT DEFINED ${var})
+ set(${var} "${default}" CACHE PATH "${description}")
+ endif()
+ _GNUInstallDirs_cache_convert_to_path("${var}" "${description}")
+endmacro()
-if(NOT DEFINED CMAKE_INSTALL_SYSCONFDIR)
- set(CMAKE_INSTALL_SYSCONFDIR "etc" CACHE PATH "read-only single-machine data (etc)")
-endif()
+# Create a cache variable with not default for a path, with a fallback
+# when unset; used for entries slaved to other entries such as
+# DATAROOTDIR.
+macro(_GNUInstallDirs_cache_path_fallback var default description)
+ if(NOT ${var})
+ set(${var} "" CACHE PATH "${description}")
+ set(${var} "${default}")
+ endif()
+ _GNUInstallDirs_cache_convert_to_path("${var}" "${description}")
+endmacro()
-if(NOT DEFINED CMAKE_INSTALL_SHAREDSTATEDIR)
- set(CMAKE_INSTALL_SHAREDSTATEDIR "com" CACHE PATH "modifiable architecture-independent data (com)")
-endif()
+# Installation directories
+#
-if(NOT DEFINED CMAKE_INSTALL_LOCALSTATEDIR)
- set(CMAKE_INSTALL_LOCALSTATEDIR "var" CACHE PATH "modifiable single-machine data (var)")
-endif()
+_GNUInstallDirs_cache_path(CMAKE_INSTALL_BINDIR "bin"
+ "User executables (bin)")
+_GNUInstallDirs_cache_path(CMAKE_INSTALL_SBINDIR "sbin"
+ "System admin executables (sbin)")
+_GNUInstallDirs_cache_path(CMAKE_INSTALL_LIBEXECDIR "libexec"
+ "Program executables (libexec)")
+_GNUInstallDirs_cache_path(CMAKE_INSTALL_SYSCONFDIR "etc"
+ "Read-only single-machine data (etc)")
+_GNUInstallDirs_cache_path(CMAKE_INSTALL_SHAREDSTATEDIR "com"
+ "Modifiable architecture-independent data (com)")
+_GNUInstallDirs_cache_path(CMAKE_INSTALL_LOCALSTATEDIR "var"
+ "Modifiable single-machine data (var)")
# We check if the variable was manually set and not cached, in order to
# allow projects to set the values as normal variables before including
@@ -219,71 +242,50 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR OR (_libdir_set
endif()
endif()
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
- set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})")
+ set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "Object code libraries (${_LIBDIR_DEFAULT})")
elseif(DEFINED __LAST_LIBDIR_DEFAULT
AND "${__LAST_LIBDIR_DEFAULT}" STREQUAL "${CMAKE_INSTALL_LIBDIR}")
set_property(CACHE CMAKE_INSTALL_LIBDIR PROPERTY VALUE "${_LIBDIR_DEFAULT}")
endif()
endif()
+_GNUInstallDirs_cache_convert_to_path(CMAKE_INSTALL_LIBDIR "Object code libraries (lib)")
+
# Save for next run
set(_GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE INTERNAL "CMAKE_INSTALL_PREFIX during last run")
unset(_libdir_set)
unset(__LAST_LIBDIR_DEFAULT)
-
-if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR)
- set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE PATH "C header files (include)")
-endif()
-
-if(NOT DEFINED CMAKE_INSTALL_OLDINCLUDEDIR)
- set(CMAKE_INSTALL_OLDINCLUDEDIR "/usr/include" CACHE PATH "C header files for non-gcc (/usr/include)")
-endif()
-
-if(NOT DEFINED CMAKE_INSTALL_DATAROOTDIR)
- set(CMAKE_INSTALL_DATAROOTDIR "share" CACHE PATH "read-only architecture-independent data root (share)")
-endif()
+_GNUInstallDirs_cache_path(CMAKE_INSTALL_INCLUDEDIR "include"
+ "C header files (include)")
+_GNUInstallDirs_cache_path(CMAKE_INSTALL_OLDINCLUDEDIR "/usr/include"
+ "C header files for non-gcc (/usr/include)")
+_GNUInstallDirs_cache_path(CMAKE_INSTALL_DATAROOTDIR "share"
+ "Read-only architecture-independent data root (share)")
#-----------------------------------------------------------------------------
# Values whose defaults are relative to DATAROOTDIR. Store empty values in
# the cache and store the defaults in local variables if the cache values are
# not set explicitly. This auto-updates the defaults as DATAROOTDIR changes.
-if(NOT CMAKE_INSTALL_DATADIR)
- set(CMAKE_INSTALL_DATADIR "" CACHE PATH "read-only architecture-independent data (DATAROOTDIR)")
- set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}")
-endif()
+_GNUInstallDirs_cache_path_fallback(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}"
+ "Read-only architecture-independent data (DATAROOTDIR)")
if(CMAKE_SYSTEM_NAME MATCHES "^(.*BSD|DragonFly)$")
- if(NOT CMAKE_INSTALL_INFODIR)
- set(CMAKE_INSTALL_INFODIR "" CACHE PATH "info documentation (info)")
- set(CMAKE_INSTALL_INFODIR "info")
- endif()
-
- if(NOT CMAKE_INSTALL_MANDIR)
- set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (man)")
- set(CMAKE_INSTALL_MANDIR "man")
- endif()
+ _GNUInstallDirs_cache_path_fallback(CMAKE_INSTALL_INFODIR "info"
+ "Info documentation (info)")
+ _GNUInstallDirs_cache_path_fallback(CMAKE_INSTALL_MANDIR "man"
+ "Man documentation (man)")
else()
- if(NOT CMAKE_INSTALL_INFODIR)
- set(CMAKE_INSTALL_INFODIR "" CACHE PATH "info documentation (DATAROOTDIR/info)")
- set(CMAKE_INSTALL_INFODIR "${CMAKE_INSTALL_DATAROOTDIR}/info")
- endif()
-
- if(NOT CMAKE_INSTALL_MANDIR)
- set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (DATAROOTDIR/man)")
- set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man")
- endif()
-endif()
-
-if(NOT CMAKE_INSTALL_LOCALEDIR)
- set(CMAKE_INSTALL_LOCALEDIR "" CACHE PATH "locale-dependent data (DATAROOTDIR/locale)")
- set(CMAKE_INSTALL_LOCALEDIR "${CMAKE_INSTALL_DATAROOTDIR}/locale")
+ _GNUInstallDirs_cache_path_fallback(CMAKE_INSTALL_INFODIR "${CMAKE_INSTALL_DATAROOTDIR}/info"
+ "Info documentation (DATAROOTDIR/info)")
+ _GNUInstallDirs_cache_path_fallback(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man"
+ "Man documentation (DATAROOTDIR/man)")
endif()
-if(NOT CMAKE_INSTALL_DOCDIR)
- set(CMAKE_INSTALL_DOCDIR "" CACHE PATH "documentation root (DATAROOTDIR/doc/PROJECT_NAME)")
- set(CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}")
-endif()
+_GNUInstallDirs_cache_path_fallback(CMAKE_INSTALL_LOCALEDIR "${CMAKE_INSTALL_DATAROOTDIR}/locale"
+ "Locale-dependent data (DATAROOTDIR/locale)")
+_GNUInstallDirs_cache_path_fallback(CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}"
+ "Documentation root (DATAROOTDIR/doc/PROJECT_NAME)")
#-----------------------------------------------------------------------------
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
index c201714..6d1b4ed 100644
--- a/Modules/GenerateExportHeader.cmake
+++ b/Modules/GenerateExportHeader.cmake
@@ -184,7 +184,6 @@
# :prop_tgt:`CXX_VISIBILITY_PRESET <<LANG>_VISIBILITY_PRESET>` and
# :prop_tgt:`VISIBILITY_INLINES_HIDDEN` instead.
-include(CMakeParseArguments)
include(CheckCXXCompilerFlag)
# TODO: Install this macro separately?
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index 5ab9dc5..1b23800 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -430,8 +430,8 @@ function(gp_resolve_item context item exepath dirs resolved_item_var)
if(WIN32 AND NOT UNIX)
if(NOT resolved)
set(ri "ri-NOTFOUND")
- find_program(ri "${item}" PATHS "${exepath};${dirs}" NO_DEFAULT_PATH)
- find_program(ri "${item}" PATHS "${exepath};${dirs}")
+ find_program(ri "${item}" PATHS ${exepath} ${dirs} NO_DEFAULT_PATH)
+ find_program(ri "${item}" PATHS ${exepath} ${dirs})
if(ri)
#message(STATUS "info: 'find_program' in exepath/dirs (${ri})")
set(resolved 1)
@@ -654,6 +654,8 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
if(NOT EXISTS "${target}")
message("warning: target '${target}' does not exist...")
+ set(${prerequisites_var} "" PARENT_SCOPE)
+ return()
endif()
set(gp_cmd_paths ${gp_cmd_paths}
@@ -810,6 +812,20 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
OUTPUT_VARIABLE gp_cmd_ov
ERROR_VARIABLE gp_ev
)
+
+ if(gp_tool STREQUAL "dumpbin")
+ # Exclude delay load dependencies under windows (they are listed in dumpbin output after the message below)
+ string(FIND "${gp_cmd_ov}" "Image has the following delay load dependencies" gp_delayload_pos)
+ if (${gp_delayload_pos} GREATER -1)
+ string(SUBSTRING "${gp_cmd_ov}" 0 ${gp_delayload_pos} gp_cmd_ov_no_delayload_deps)
+ string(SUBSTRING "${gp_cmd_ov}" ${gp_delayload_pos} -1 gp_cmd_ov_delayload_deps)
+ if (verbose)
+ message(STATUS "GetPrequisites(${target}) : ignoring the following delay load dependencies :\n ${gp_cmd_ov_delayload_deps}")
+ endif()
+ set(gp_cmd_ov ${gp_cmd_ov_no_delayload_deps})
+ endif()
+ endif()
+
if(NOT gp_rv STREQUAL "0")
if(gp_tool STREQUAL "dumpbin")
# dumpbin error messages seem to go to stdout
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
index b0446c9..7975bd4 100644
--- a/Modules/InstallRequiredSystemLibraries.cmake
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -182,7 +182,10 @@ if(MSVC)
"${MSVC${v}_CRT_DIR}/msvcp${v}0.dll"
)
if(NOT v VERSION_LESS 14)
- list(APPEND __install__libs "${MSVC${v}_CRT_DIR}/vcruntime${v}0.dll")
+ list(APPEND __install__libs
+ "${MSVC${v}_CRT_DIR}/vcruntime${v}0.dll"
+ "${MSVC${v}_CRT_DIR}/concrt${v}0.dll"
+ )
else()
list(APPEND __install__libs "${MSVC${v}_CRT_DIR}/msvcr${v}0.dll")
endif()
@@ -197,28 +200,37 @@ if(MSVC)
"${MSVC${v}_CRT_DIR}/msvcp${v}0d.dll"
)
if(NOT v VERSION_LESS 14)
- list(APPEND __install__libs "${MSVC${v}_CRT_DIR}/vcruntime${v}0d.dll")
+ list(APPEND __install__libs
+ "${MSVC${v}_CRT_DIR}/vcruntime${v}0d.dll"
+ "${MSVC${v}_CRT_DIR}/concrt${v}0d.dll"
+ )
else()
list(APPEND __install__libs "${MSVC${v}_CRT_DIR}/msvcr${v}0d.dll")
endif()
endif()
if(CMAKE_INSTALL_UCRT_LIBRARIES AND NOT v VERSION_LESS 14)
- # Find the Windows Universal CRT redistribution directory.
+ # Find the Windows Kits directory.
get_filename_component(windows_kits_dir
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" ABSOLUTE)
set(programfilesx86 "ProgramFiles(x86)")
- find_path(WINDOWS_KITS_REDIST_DIR NAMES ucrt/DLLs/${CMAKE_MSVC_ARCH}/ucrtbase.dll
+ find_path(WINDOWS_KITS_DIR NAMES Redist/ucrt/DLLs/${CMAKE_MSVC_ARCH}/ucrtbase.dll
PATHS
- "${windows_kits_dir}/Redist"
- "$ENV{ProgramFiles}/Windows Kits/10/Redist"
- "$ENV{${programfilesx86}}/Windows Kits/10/Redist"
+ "${windows_kits_dir}"
+ "$ENV{ProgramFiles}/Windows Kits/10"
+ "$ENV{${programfilesx86}}/Windows Kits/10"
)
- mark_as_advanced(WINDOWS_KITS_REDIST_DIR)
+ mark_as_advanced(WINDOWS_KITS_DIR)
# Glob the list of UCRT DLLs.
- file(GLOB __ucrt_dlls "${WINDOWS_KITS_REDIST_DIR}/ucrt/DLLs/${CMAKE_MSVC_ARCH}/*.dll")
- list(APPEND __install__libs ${__ucrt_dlls})
+ if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
+ file(GLOB __ucrt_dlls "${WINDOWS_KITS_DIR}/Redist/ucrt/DLLs/${CMAKE_MSVC_ARCH}/*.dll")
+ list(APPEND __install__libs ${__ucrt_dlls})
+ endif()
+ if(CMAKE_INSTALL_DEBUG_LIBRARIES)
+ file(GLOB __ucrt_dlls "${WINDOWS_KITS_DIR}/bin/${CMAKE_MSVC_ARCH}/ucrt/*.dll")
+ list(APPEND __install__libs ${__ucrt_dlls})
+ endif()
endif()
endmacro()
diff --git a/Modules/Internal/FeatureTesting.cmake b/Modules/Internal/FeatureTesting.cmake
index 86b89b2..50b8526 100644
--- a/Modules/Internal/FeatureTesting.cmake
+++ b/Modules/Internal/FeatureTesting.cmake
@@ -1,5 +1,5 @@
-macro(record_compiler_features lang compile_flags feature_list)
+macro(_record_compiler_features lang compile_flags feature_list)
include("${CMAKE_ROOT}/Modules/Compiler/${CMAKE_${lang}_COMPILER_ID}-${lang}-FeatureTests.cmake" OPTIONAL)
string(TOLOWER ${lang} lang_lc)
@@ -58,3 +58,13 @@ macro(record_compiler_features lang compile_flags feature_list)
"Detecting ${lang} [${compile_flags}] compiler features failed to compile with the following output:\n${_output}\n${_copy_error}\n\n")
endif()
endmacro()
+
+macro(_record_compiler_features_c std)
+ list(APPEND CMAKE_C${std}_COMPILE_FEATURES c_std_${std})
+ _record_compiler_features(C "${CMAKE_C${std}_STANDARD_COMPILE_OPTION}" CMAKE_C${std}_COMPILE_FEATURES)
+endmacro()
+
+macro(_record_compiler_features_cxx std)
+ list(APPEND CMAKE_CXX${std}_COMPILE_FEATURES cxx_std_${std})
+ _record_compiler_features(CXX "${CMAKE_CXX${std}_STANDARD_COMPILE_OPTION}" CMAKE_CXX${std}_COMPILE_FEATURES)
+endmacro()
diff --git a/Modules/Platform/Android-Clang-ASM.cmake b/Modules/Platform/Android-Clang-ASM.cmake
new file mode 100644
index 0000000..6448da6
--- /dev/null
+++ b/Modules/Platform/Android-Clang-ASM.cmake
@@ -0,0 +1,2 @@
+include(Platform/Android-Clang)
+__android_compiler_clang(ASM)
diff --git a/Modules/Platform/Android-Clang.cmake b/Modules/Platform/Android-Clang.cmake
index f0cf4a5..f739ab1 100644
--- a/Modules/Platform/Android-Clang.cmake
+++ b/Modules/Platform/Android-Clang.cmake
@@ -35,7 +35,9 @@ include(Platform/Android-Common)
include(Platform/Android/abi-${CMAKE_ANDROID_ARCH_ABI}-Clang)
macro(__android_compiler_clang lang)
- __android_compiler_common(${lang})
+ if(NOT "x${lang}" STREQUAL "xASM")
+ __android_compiler_common(${lang})
+ endif()
if(NOT CMAKE_${lang}_COMPILER_TARGET)
set(CMAKE_${lang}_COMPILER_TARGET "${_ANDROID_ABI_CLANG_TARGET}")
endif()
diff --git a/Modules/Platform/Android-Common.cmake b/Modules/Platform/Android-Common.cmake
index 8755d4f..cf2785a 100644
--- a/Modules/Platform/Android-Common.cmake
+++ b/Modules/Platform/Android-Common.cmake
@@ -149,4 +149,13 @@ macro(__android_compiler_common lang)
if("x${lang}" STREQUAL "xCXX")
__android_stl(CXX)
endif()
+
+ # <ndk>/build/core/definitions.mk appends the sysroot's include directory
+ # explicitly at the end of the command-line include path so that it
+ # precedes the toolchain's builtin include directories. This is
+ # necessary so that Android API-version-specific headers are preferred
+ # over those in the toolchain's `include-fixed` directory (which cannot
+ # possibly match all versions).
+ list(APPEND CMAKE_${lang}_STANDARD_INCLUDE_DIRECTORIES "${CMAKE_SYSROOT}/usr/include")
+ list(REMOVE_ITEM CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES "/usr/include")
endmacro()
diff --git a/Modules/Platform/Android/ndk-stl-c++.cmake b/Modules/Platform/Android/ndk-stl-c++.cmake
index b27015d..a12411c 100644
--- a/Modules/Platform/Android/ndk-stl-c++.cmake
+++ b/Modules/Platform/Android/ndk-stl-c++.cmake
@@ -6,16 +6,15 @@ macro(__android_stl_cxx lang filename)
if(EXISTS "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libcxx/include/cstddef")
# r12 and below
__android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libcxx/include" 1)
+ __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/android/support/include" 0)
__android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++abi/libcxxabi/include" 1)
else()
# r13 and above
__android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/include" 1)
+ __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/android/support/include" 0)
__android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++abi/include" 1)
endif()
- # Add a secondary include directory if it exists.
- __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/android/support/include" 0)
-
# Add the library file.
__android_stl_lib(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${CMAKE_ANDROID_ARCH_ABI}/${filename}" 1)
endmacro()
diff --git a/Modules/Platform/Darwin-PGI-C.cmake b/Modules/Platform/Darwin-PGI-C.cmake
new file mode 100644
index 0000000..790919b
--- /dev/null
+++ b/Modules/Platform/Darwin-PGI-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/Darwin-PGI)
+__darwin_compiler_pgi(C)
diff --git a/Modules/Platform/Darwin-PGI-CXX.cmake b/Modules/Platform/Darwin-PGI-CXX.cmake
new file mode 100644
index 0000000..ceaed71
--- /dev/null
+++ b/Modules/Platform/Darwin-PGI-CXX.cmake
@@ -0,0 +1,2 @@
+include(Platform/Darwin-PGI)
+__darwin_compiler_pgi(CXX)
diff --git a/Modules/Platform/Darwin-PGI-Fortran.cmake b/Modules/Platform/Darwin-PGI-Fortran.cmake
new file mode 100644
index 0000000..146807b
--- /dev/null
+++ b/Modules/Platform/Darwin-PGI-Fortran.cmake
@@ -0,0 +1,2 @@
+include(Platform/Darwin-PGI)
+__darwin_compiler_pgi(Fortran)
diff --git a/Modules/Platform/Darwin-PGI.cmake b/Modules/Platform/Darwin-PGI.cmake
new file mode 100644
index 0000000..04479a8
--- /dev/null
+++ b/Modules/Platform/Darwin-PGI.cmake
@@ -0,0 +1,14 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+# This module is shared by multiple languages; use include blocker.
+if(__DARWIN_COMPILER_PGI)
+ return()
+endif()
+set(__DARWIN_COMPILER_PGI 1)
+
+macro(__darwin_compiler_pgi lang)
+ set(CMAKE_${lang}_OSX_COMPATIBILITY_VERSION_FLAG "-Wl,-compatibility_version,")
+ set(CMAKE_${lang}_OSX_CURRENT_VERSION_FLAG "-Wl,-current_version,")
+ set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,-install_name")
+endmacro()
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index 26b12a1..727baa6 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -81,8 +81,6 @@ if("${_CURRENT_OSX_VERSION}" VERSION_LESS "10.5")
set(CMAKE_LINK_DEPENDENT_LIBRARY_FILES 1)
endif()
-set(CMAKE_C_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS -w)
-set(CMAKE_CXX_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS -w)
set(CMAKE_C_CREATE_SHARED_LIBRARY
"<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <LINK_FLAGS> -o <TARGET> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>")
set(CMAKE_CXX_CREATE_SHARED_LIBRARY
diff --git a/Modules/Platform/Fuchsia.cmake b/Modules/Platform/Fuchsia.cmake
new file mode 100644
index 0000000..896da7b
--- /dev/null
+++ b/Modules/Platform/Fuchsia.cmake
@@ -0,0 +1,25 @@
+set(FUCHSIA 1)
+
+set(CMAKE_DL_LIBS "")
+set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
+set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
+set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC")
+set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")
+set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
+set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
+set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
+set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
+set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
+
+# Shared libraries with no builtin soname may not be linked safely by
+# specifying the file path.
+set(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1)
+
+# Initialize C link type selection flags. These flags are used when
+# building a shared library, shared module, or executable that links
+# to other libraries to select whether to use the static or shared
+# versions of the libraries.
+foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
+ set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
+ set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
+endforeach()
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index d72ec66..0e90d35 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -54,6 +54,8 @@ if(NOT MSVC_VERSION)
set(_compiler_version ${CMAKE_CXX_SIMULATE_VERSION})
elseif(CMAKE_Fortran_SIMULATE_VERSION)
set(_compiler_version ${CMAKE_Fortran_SIMULATE_VERSION})
+ elseif(CMAKE_CUDA_SIMULATE_VERSION)
+ set(_compiler_version ${CMAKE_CUDA_SIMULATE_VERSION})
elseif(CMAKE_C_COMPILER_VERSION)
set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
else()
@@ -285,13 +287,13 @@ macro(__windows_compiler_msvc lang)
# note: MSVC 14 2015 Update 1 sets -fno-ms-compatibility by default, but this does not allow one to compile many projects
# that include MS's own headers. CMake itself is affected project too.
string(APPEND CMAKE_${lang}_FLAGS_INIT " ${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} -fms-extensions -fms-compatibility -D_WINDOWS -Wall${_FLAGS_${lang}}")
- string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -D_DEBUG /MDd -gline-tables-only -fno-inline -O0 ${_RTC1}")
+ string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " /MDd -gline-tables-only -fno-inline -O0 ${_RTC1}")
string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " /MD -O2 -DNDEBUG")
string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " /MD -gline-tables-only -O2 -fno-inline -DNDEBUG")
string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " /MD -DNDEBUG") # TODO: Add '-Os' once VS generator maps it properly for Clang
else()
string(APPEND CMAKE_${lang}_FLAGS_INIT " ${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3${_FLAGS_${lang}}")
- string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " /D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}")
+ string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " /MDd /Zi /Ob0 /Od ${_RTC1}")
string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " /MD /O2 /Ob2 /DNDEBUG")
string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " /MD /Zi /O2 /Ob1 /DNDEBUG")
string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " /MD /O1 /Ob1 /DNDEBUG")
diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
new file mode 100644
index 0000000..845fa4b
--- /dev/null
+++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
@@ -0,0 +1,46 @@
+include(Platform/Windows-MSVC)
+
+set(CMAKE_CUDA_COMPILE_PTX_COMPILATION
+ "<CMAKE_CUDA_COMPILER> ${CMAKE_CUDA_HOST_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -x cu -ptx <SOURCE> -o <OBJECT> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS")
+set(CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION
+ "<CMAKE_CUDA_COMPILER> ${CMAKE_CUDA_HOST_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -x cu -dc <SOURCE> -o <OBJECT> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS")
+set(CMAKE_CUDA_COMPILE_WHOLE_COMPILATION
+ "<CMAKE_CUDA_COMPILER> ${CMAKE_CUDA_HOST_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -x cu -c <SOURCE> -o <OBJECT> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS")
+
+set(__IMPLICT_LINKS )
+foreach(dir ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES})
+ string(APPEND __IMPLICT_LINKS " -LIBPATH:\"${dir}\"")
+endforeach()
+foreach(lib ${CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES})
+ string(APPEND __IMPLICT_LINKS " \"${lib}\"")
+endforeach()
+set(CMAKE_CUDA_LINK_EXECUTABLE
+ "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_CUDA_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <LINK_LIBRARIES>${__IMPLICT_LINKS}")
+
+set(_CMAKE_VS_LINK_DLL "<CMAKE_COMMAND> -E vs_link_dll --intdir=<OBJECT_DIR> --manifests <MANIFESTS> -- ")
+set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe --intdir=<OBJECT_DIR> --manifests <MANIFESTS> -- ")
+set(CMAKE_CUDA_CREATE_SHARED_LIBRARY
+ "${_CMAKE_VS_LINK_DLL}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <LINK_FLAGS> <LINK_LIBRARIES>${__IMPLICT_LINKS} ${CMAKE_END_TEMP_FILE}")
+
+set(CMAKE_CUDA_CREATE_SHARED_MODULE ${CMAKE_CUDA_CREATE_SHARED_LIBRARY})
+set(CMAKE_CUDA_CREATE_STATIC_LIBRARY "<CMAKE_LINKER> /lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ")
+set(CMAKE_CUDA_LINKER_SUPPORTS_PDB ON)
+set(CMAKE_CUDA_LINK_EXECUTABLE
+ "${_CMAKE_VS_LINK_EXE}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <CMAKE_CUDA_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${__IMPLICT_LINKS} ${CMAKE_END_TEMP_FILE}")
+unset(_CMAKE_VS_LINK_EXE)
+unset(_CMAKE_VS_LINK_EXE)
+
+set(CMAKE_CUDA_DEVICE_LINK_LIBRARY
+ "<CMAKE_CUDA_COMPILER> <CMAKE_CUDA_LINK_FLAGS> <LANGUAGE_COMPILE_FLAGS> -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS")
+set(CMAKE_CUDA_DEVICE_LINK_EXECUTABLE
+ "<CMAKE_CUDA_COMPILER> <FLAGS> <CMAKE_CUDA_LINK_FLAGS> -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS")
+
+string(REPLACE "/D" "-D" _PLATFORM_DEFINES_CUDA "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_CXX}")
+
+string(APPEND CMAKE_CUDA_FLAGS_INIT " ${PLATFORM_DEFINES_CUDA} -D_WINDOWS -Xcompiler=\"/W3${_FLAGS_CXX}\"")
+string(APPEND CMAKE_CUDA_FLAGS_DEBUG_INIT " -Xcompiler=\"-MDd -Zi -Ob0 -Od ${_RTC1}\"")
+string(APPEND CMAKE_CUDA_FLAGS_RELEASE_INIT " -Xcompiler=\"-MD -O2 -Ob2\" -DNDEBUG")
+string(APPEND CMAKE_CUDA_FLAGS_RELWITHDEBINFO_INIT " -Xcompiler=\"-MD -Zi -O2 -Ob1\" -DNDEBUG")
+string(APPEND CMAKE_CUDA_FLAGS_MINSIZEREL_INIT " -Xcompiler=\"-MD -O1 -Ob1\" -DNDEBUG")
+
+set(CMAKE_CUDA_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
diff --git a/Modules/Platform/Windows.cmake b/Modules/Platform/Windows.cmake
index 9a937a7..d8b3957 100644
--- a/Modules/Platform/Windows.cmake
+++ b/Modules/Platform/Windows.cmake
@@ -17,6 +17,7 @@ set(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib")
set(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe
set(CMAKE_LINK_LIBRARY_SUFFIX ".lib")
set(CMAKE_DL_LIBS "")
+set(CMAKE_EXTRA_LINK_EXTENSIONS ".targets")
set(CMAKE_FIND_LIBRARY_PREFIXES "")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake
index 0279d1c..0478918 100644
--- a/Modules/Qt4Macros.cmake
+++ b/Modules/Qt4Macros.cmake
@@ -439,7 +439,7 @@ macro(QT4_CREATE_TRANSLATION _qm_files)
get_filename_component(_abs_include "${_pro_include}" ABSOLUTE)
string(APPEND _pro_includes " \\\n \"${_abs_include}\"")
endforeach()
- file(WRITE ${_ts_pro} "SOURCES =${_pro_srcs}\nINCLUDEPATH =${_pro_includes}\n")
+ file(GENERATE OUTPUT ${_ts_pro} CONTENT "SOURCES =${_pro_srcs}\nINCLUDEPATH =${_pro_includes}\n")
endif()
add_custom_command(OUTPUT ${_ts_file}
COMMAND Qt4::lupdate
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index 6b34c8f..93255ae 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -403,8 +403,6 @@
# Sets the directory where the header files will be generated. Same behavior as option
# '-d' of javah tool. If not specified, ${CMAKE_CURRENT_BINARY_DIR} is used as output directory.
-include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
-
function (__java_copy_file src dest comment)
add_custom_command(
OUTPUT ${dest}
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index d242f87..277f4ca 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -9,18 +9,22 @@
#
# ::
#
-# SWIG_ADD_MODULE(name language [ files ])
+# SWIG_ADD_LIBRARY(<name>
+# [TYPE <SHARED|MODULE|STATIC|USE_BUILD_SHARED_LIBS>]
+# LANGUAGE <language>
+# SOURCES <file>...
+# )
# - Define swig module with given name and specified language
# SWIG_LINK_LIBRARIES(name [ libraries ])
# - Link libraries to swig module
#
# Source files properties on module files can be set before the invocation
-# of the SWIG_ADD_MODULE macro to specify special behavior of SWIG.
+# of the SWIG_ADD_LIBRARY macro to specify special behavior of SWIG.
#
# The source file property CPLUSPLUS calls SWIG in c++ mode, e.g.::
#
# set_property(SOURCE mymod.i PROPERTY CPLUSPLUS ON)
-# swig_add_module(mymod python mymod.i)
+# swig_add_library(mymod LANGUAGE python SOURCES mymod.i)
#
# The source file property SWIG_FLAGS adds custom flags to the SWIG executable.
#
@@ -36,8 +40,11 @@
#
# CMAKE_SWIG_FLAGS can be used to add special flags to all swig calls.
#
-# Another special variable is CMAKE_SWIG_OUTDIR, it allows one to specify
-# where to write all the swig generated module (swig -outdir option)
+# CMAKE_SWIG_OUTDIR allows one to specify where to write
+# the language specific files (swig -outdir option).
+#
+# SWIG_OUTFILE_DIR allows one to specify where to write the output file
+# (swig -o option). If not specified, CMAKE_SWIG_OUTDIR is used.
#
# The name-specific variable SWIG_MODULE_<name>_EXTRA_DEPS may be used to specify extra
# dependencies for the generated modules.
@@ -50,7 +57,8 @@
set(SWIG_CXX_EXTENSION "cxx")
set(SWIG_EXTRA_LIBRARIES "")
-set(SWIG_PYTHON_EXTRA_FILE_EXTENSION "py")
+set(SWIG_PYTHON_EXTRA_FILE_EXTENSIONS ".py")
+set(SWIG_JAVA_EXTRA_FILE_EXTENSIONS ".java" "JNI.java")
#
# For given swig module initialize variables associated with it
@@ -116,9 +124,9 @@ macro(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile)
endif ()
endif()
- foreach(it ${SWIG_${language}_EXTRA_FILE_EXTENSION})
+ foreach(it ${SWIG_${language}_EXTRA_FILE_EXTENSIONS})
set(${outfiles} ${${outfiles}}
- "${generatedpath}/${SWIG_GET_EXTRA_OUTPUT_FILES_module_basename}.${it}")
+ "${generatedpath}/${SWIG_GET_EXTRA_OUTPUT_FILES_module_basename}${it}")
endforeach()
endmacro()
@@ -142,6 +150,13 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
else()
set(swig_outdir ${CMAKE_CURRENT_BINARY_DIR})
endif()
+
+ if(SWIG_OUTFILE_DIR)
+ set(swig_outfile_dir ${SWIG_OUTFILE_DIR})
+ else()
+ set(swig_outfile_dir ${swig_outdir})
+ endif()
+
if (NOT SWIG_MODULE_${name}_NOPROXY)
SWIG_GET_EXTRA_OUTPUT_FILES(${SWIG_MODULE_${name}_LANGUAGE}
swig_extra_generated_files
@@ -149,7 +164,7 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
"${swig_source_file_fullname}")
endif()
set(swig_generated_file_fullname
- "${swig_outdir}/${swig_source_file_name_we}")
+ "${swig_outfile_dir}/${swig_source_file_name_we}")
# add the language into the name of the file (i.e. TCL_wrap)
# this allows for the same .i file to be wrapped into different languages
string(APPEND swig_generated_file_fullname
@@ -197,6 +212,7 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
"${swig_source_file_fullname}"
MAIN_DEPENDENCY "${swig_source_file_fullname}"
DEPENDS ${SWIG_MODULE_${name}_EXTRA_DEPS}
+ IMPLICIT_DEPENDS CXX "${swig_source_file_fullname}"
COMMENT "Swig source")
set_source_files_properties("${swig_generated_file_fullname}" ${swig_extra_generated_files}
PROPERTIES GENERATED 1)
@@ -207,10 +223,40 @@ endmacro()
# Create Swig module
#
macro(SWIG_ADD_MODULE name language)
- SWIG_MODULE_INITIALIZE(${name} ${language})
+ message(DEPRECATION "SWIG_ADD_MODULE is deprecated. Use SWIG_ADD_LIBRARY instead.")
+ swig_add_library(${name}
+ LANGUAGE ${language}
+ TYPE MODULE
+ SOURCES ${ARGN})
+endmacro()
+
+
+macro(SWIG_ADD_LIBRARY name)
+ set(options "")
+ set(oneValueArgs LANGUAGE
+ TYPE)
+ set(multiValueArgs SOURCES)
+ cmake_parse_arguments(_SAM "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+ if(NOT DEFINED _SAM_LANGUAGE)
+ message(FATAL_ERROR "SWIG_ADD_LIBRARY: Missing LANGUAGE argument")
+ endif()
+
+ if(NOT DEFINED _SAM_SOURCES)
+ message(FATAL_ERROR "SWIG_ADD_LIBRARY: Missing SOURCES argument")
+ endif()
+
+ if(NOT DEFINED _SAM_TYPE)
+ set(_SAM_TYPE MODULE)
+ elseif("${_SAM_TYPE}" STREQUAL "USE_BUILD_SHARED_LIBS")
+ unset(_SAM_TYPE)
+ endif()
+
+ swig_module_initialize(${name} ${_SAM_LANGUAGE})
+
set(swig_dot_i_sources)
set(swig_other_sources)
- foreach(it ${ARGN})
+ foreach(it ${_SAM_SOURCES})
if(${it} MATCHES "\\.i$")
set(swig_dot_i_sources ${swig_dot_i_sources} "${it}")
else()
@@ -227,11 +273,13 @@ macro(SWIG_ADD_MODULE name language)
set_directory_properties(PROPERTIES
ADDITIONAL_MAKE_CLEAN_FILES "${swig_extra_clean_files};${swig_generated_sources}")
add_library(${SWIG_MODULE_${name}_REAL_NAME}
- MODULE
+ ${_SAM_TYPE}
${swig_generated_sources}
${swig_other_sources})
- set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES NO_SONAME ON)
- string(TOLOWER "${language}" swig_lowercase_language)
+ if("${_SAM_TYPE}" STREQUAL "MODULE")
+ set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES NO_SONAME ON)
+ endif()
+ string(TOLOWER "${_SAM_LANGUAGE}" swig_lowercase_language)
if ("${swig_lowercase_language}" STREQUAL "octave")
set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "")
set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".oct")
@@ -248,7 +296,9 @@ macro(SWIG_ADD_MODULE name language)
set_target_properties (${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".jnilib")
endif ()
elseif ("${swig_lowercase_language}" STREQUAL "lua")
- set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "")
+ if("${_SAM_TYPE}" STREQUAL "MODULE")
+ set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "")
+ endif()
elseif ("${swig_lowercase_language}" STREQUAL "python")
# this is only needed for the python case where a _modulename.so is generated
set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "")
@@ -289,4 +339,3 @@ macro(SWIG_LINK_LIBRARIES name)
message(SEND_ERROR "Cannot find Swig library \"${name}\".")
endif()
endmacro()
-
diff --git a/Modules/WriteBasicConfigVersionFile.cmake b/Modules/WriteBasicConfigVersionFile.cmake
index 20c769e..7c9467a 100644
--- a/Modules/WriteBasicConfigVersionFile.cmake
+++ b/Modules/WriteBasicConfigVersionFile.cmake
@@ -18,8 +18,6 @@
#
# Deprecated, see WRITE_BASIC_PACKAGE_VERSION_FILE(), it is identical.
-include(CMakeParseArguments)
-
function(WRITE_BASIC_CONFIG_VERSION_FILE _filename)
set(options )
diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake
index 82e8fba..0b16aa4 100644
--- a/Modules/WriteCompilerDetectionHeader.cmake
+++ b/Modules/WriteCompilerDetectionHeader.cmake
@@ -20,6 +20,8 @@
# [VERSION <version>]
# [PROLOG <prolog>]
# [EPILOG <epilog>]
+# [ALLOW_UNKNOWN_COMPILERS]
+# [ALLOW_UNKNOWN_COMPILER_VERSIONS]
# )
#
# The ``write_compiler_detection_header`` function generates the
@@ -76,10 +78,16 @@
# Available features in this version of CMake are listed in the
# :prop_gbl:`CMAKE_C_KNOWN_FEATURES` and
# :prop_gbl:`CMAKE_CXX_KNOWN_FEATURES` global properties.
+# The ``{c,cxx}_std_*`` meta-features are ignored if requested.
#
# See the :manual:`cmake-compile-features(7)` manual for information on
# compile features.
#
+# ``ALLOW_UNKNOWN_COMPILERS`` and ``ALLOW_UNKNOWN_COMPILER_VERSIONS`` cause
+# the module to generate conditions that treat unknown compilers as simply
+# lacking all features. Without these options the default behavior is to
+# generate a ``#error`` for unknown compilers.
+#
# Feature Test Macros
# ===================
#
@@ -215,7 +223,6 @@
# CompatSupport_DEPRECATED=
# )
-include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CMakeCompilerIdDetection.cmake)
function(_load_compiler_variables CompilerId lang)
@@ -232,6 +239,19 @@ function(_load_compiler_variables CompilerId lang)
set(_compiler_id_version_compute_${CompilerId} ${_compiler_id_version_compute} PARENT_SCOPE)
endfunction()
+macro(_simpledefine FEATURE_NAME FEATURE_TESTNAME FEATURE_STRING FEATURE_DEFAULT_STRING)
+ if (feature STREQUAL "${FEATURE_NAME}")
+ set(def_value "${prefix_arg}_${FEATURE_TESTNAME}")
+ string(APPEND file_content "
+# if defined(${def_name}) && ${def_name}
+# define ${def_value} ${FEATURE_STRING}
+# else
+# define ${def_value} ${FEATURE_DEFAULT_STRING}
+# endif
+\n")
+ endif()
+endmacro()
+
function(write_compiler_detection_header
file_keyword file_arg
prefix_keyword prefix_arg
@@ -242,7 +262,7 @@ function(write_compiler_detection_header
if (NOT "x${prefix_keyword}" STREQUAL "xPREFIX")
message(FATAL_ERROR "write_compiler_detection_header: PREFIX parameter missing.")
endif()
- set(options)
+ set(options ALLOW_UNKNOWN_COMPILERS ALLOW_UNKNOWN_COMPILER_VERSIONS)
set(oneValueArgs VERSION EPILOG PROLOG OUTPUT_FILES_VAR OUTPUT_DIR)
set(multiValueArgs COMPILERS FEATURES)
cmake_parse_arguments(_WCD "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
@@ -358,7 +378,11 @@ function(write_compiler_detection_header
endif()
foreach(feature ${_WCD_FEATURES})
- if (feature MATCHES "^cxx_")
+ if (feature MATCHES "^c_std_")
+ # ignored
+ elseif (feature MATCHES "^cxx_std_")
+ # ignored
+ elseif (feature MATCHES "^cxx_")
list(APPEND _langs CXX)
list(APPEND CXX_features ${feature})
elseif (feature MATCHES "^c_")
@@ -422,10 +446,12 @@ function(write_compiler_detection_header
set(compiler_file_content file_content)
endif()
- set(${compiler_file_content} "${${compiler_file_content}}
+ if(NOT _WCD_ALLOW_UNKNOWN_COMPILER_VERSIONS)
+ set(${compiler_file_content} "${${compiler_file_content}}
# if !(${_cmake_oldestSupported_${compiler}})
# error Unsupported compiler version
# endif\n")
+ endif()
set(PREFIX ${prefix_arg}_)
if (_need_hex_conversion)
@@ -456,67 +482,36 @@ function(write_compiler_detection_header
endforeach()
endforeach()
if(pp_if STREQUAL "elif")
- string(APPEND file_content "
+ if(_WCD_ALLOW_UNKNOWN_COMPILERS)
+ string(APPEND file_content "
+# endif\n")
+ else()
+ string(APPEND file_content "
# else
# error Unsupported compiler
# endif\n")
+ endif()
endif()
foreach(feature ${${_lang}_features})
string(TOUPPER ${feature} feature_upper)
set(feature_PP "COMPILER_${feature_upper}")
set(def_name ${prefix_arg}_${feature_PP})
- if (feature STREQUAL c_restrict)
- set(def_value "${prefix_arg}_RESTRICT")
- string(APPEND file_content "
-# if ${def_name}
-# define ${def_value} restrict
-# else
-# define ${def_value}
-# endif
-\n")
- endif()
- if (feature STREQUAL cxx_constexpr)
- set(def_value "${prefix_arg}_CONSTEXPR")
- string(APPEND file_content "
-# if ${def_name}
-# define ${def_value} constexpr
-# else
-# define ${def_value}
-# endif
-\n")
- endif()
- if (feature STREQUAL cxx_final)
- set(def_value "${prefix_arg}_FINAL")
- string(APPEND file_content "
-# if ${def_name}
-# define ${def_value} final
-# else
-# define ${def_value}
-# endif
-\n")
- endif()
- if (feature STREQUAL cxx_override)
- set(def_value "${prefix_arg}_OVERRIDE")
- string(APPEND file_content "
-# if ${def_name}
-# define ${def_value} override
-# else
-# define ${def_value}
-# endif
-\n")
- endif()
+ _simpledefine(c_restrict RESTRICT restrict "")
+ _simpledefine(cxx_constexpr CONSTEXPR constexpr "")
+ _simpledefine(cxx_final FINAL final "")
+ _simpledefine(cxx_override OVERRIDE override "")
if (feature STREQUAL cxx_static_assert)
set(def_value "${prefix_arg}_STATIC_ASSERT(X)")
set(def_value_msg "${prefix_arg}_STATIC_ASSERT_MSG(X, MSG)")
set(static_assert_struct "template<bool> struct ${prefix_arg}StaticAssert;\ntemplate<> struct ${prefix_arg}StaticAssert<true>{};\n")
set(def_standard "# define ${def_value} static_assert(X, #X)\n# define ${def_value_msg} static_assert(X, MSG)")
set(def_alternative "${static_assert_struct}# define ${def_value} sizeof(${prefix_arg}StaticAssert<X>)\n# define ${def_value_msg} sizeof(${prefix_arg}StaticAssert<X>)")
- string(APPEND file_content "# if ${def_name}\n${def_standard}\n# else\n${def_alternative}\n# endif\n\n")
+ string(APPEND file_content "# if defined(${def_name}) && ${def_name}\n${def_standard}\n# else\n${def_alternative}\n# endif\n\n")
endif()
if (feature STREQUAL cxx_alignas)
set(def_value "${prefix_arg}_ALIGNAS(X)")
string(APPEND file_content "
-# if ${def_name}
+# if defined(${def_name}) && ${def_name}
# define ${def_value} alignas(X)
# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang || ${prefix_arg}_COMPILER_IS_AppleClang
# define ${def_value} __attribute__ ((__aligned__(X)))
@@ -530,7 +525,7 @@ function(write_compiler_detection_header
if (feature STREQUAL cxx_alignof)
set(def_value "${prefix_arg}_ALIGNOF(X)")
string(APPEND file_content "
-# if ${def_name}
+# if defined(${def_name}) && ${def_name}
# define ${def_value} alignof(X)
# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang || ${prefix_arg}_COMPILER_IS_AppleClang
# define ${def_value} __alignof__(X)
@@ -539,30 +534,12 @@ function(write_compiler_detection_header
# endif
\n")
endif()
- if (feature STREQUAL cxx_deleted_functions)
- set(def_value "${prefix_arg}_DELETED_FUNCTION")
- string(APPEND file_content "
-# if ${def_name}
-# define ${def_value} = delete
-# else
-# define ${def_value}
-# endif
-\n")
- endif()
- if (feature STREQUAL cxx_extern_templates)
- set(def_value "${prefix_arg}_EXTERN_TEMPLATE")
- string(APPEND file_content "
-# if ${def_name}
-# define ${def_value} extern
-# else
-# define ${def_value}
-# endif
-\n")
- endif()
+ _simpledefine(cxx_deleted_functions DELETED_FUNCTION "= delete" "")
+ _simpledefine(cxx_extern_templates EXTERN_TEMPLATE extern "")
if (feature STREQUAL cxx_noexcept)
set(def_value "${prefix_arg}_NOEXCEPT")
string(APPEND file_content "
-# if ${def_name}
+# if defined(${def_name}) && ${def_name}
# define ${def_value} noexcept
# define ${def_value}_EXPR(X) noexcept(X)
# else
@@ -571,20 +548,11 @@ function(write_compiler_detection_header
# endif
\n")
endif()
- if (feature STREQUAL cxx_nullptr)
- set(def_value "${prefix_arg}_NULLPTR")
- string(APPEND file_content "
-# if ${def_name}
-# define ${def_value} nullptr
-# else
-# define ${def_value} 0
-# endif
-\n")
- endif()
+ _simpledefine(cxx_nullptr NULLPTR nullptr 0)
if (feature STREQUAL cxx_thread_local)
set(def_value "${prefix_arg}_THREAD_LOCAL")
string(APPEND file_content "
-# if ${def_name}
+# if defined(${def_name}) && ${def_name}
# define ${def_value} thread_local
# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang || ${prefix_arg}_COMPILER_IS_AppleClang
# define ${def_value} __thread
@@ -600,7 +568,7 @@ function(write_compiler_detection_header
set(def_value "${prefix_arg}_DEPRECATED")
string(APPEND file_content "
# ifndef ${def_value}
-# if ${def_name}
+# if defined(${def_name}) && ${def_name}
# define ${def_value} [[deprecated]]
# define ${def_value}_MSG(MSG) [[deprecated(MSG)]]
# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang