summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.clang-format10
-rw-r--r--.gitlab-ci.yml30
-rw-r--r--.gitlab/ci/configure_fedora31_sphinx.cmake8
-rwxr-xr-x.gitlab/ci/docker/fedora31/install_deps.sh8
-rw-r--r--.gitlab/ci/gitlab_ci.cmake3
-rw-r--r--Auxiliary/vim/syntax/cmake.vim2
-rw-r--r--CMakeLists.txt13
-rw-r--r--CONTRIBUTING.rst4
-rw-r--r--CTestConfig.cmake2
-rw-r--r--CTestCustom.cmake.in3
-rw-r--r--Help/command/FIND_XXX.txt4
-rw-r--r--Help/command/add_compile_options.rst3
-rw-r--r--Help/command/add_test.rst5
-rw-r--r--Help/command/cmake_language.rst (renamed from Help/command/cmake_command.rst)26
-rw-r--r--Help/command/find_package.rst16
-rw-r--r--Help/command/function.rst6
-rw-r--r--Help/command/get_property.rst10
-rw-r--r--Help/command/get_source_file_property.rst11
-rw-r--r--Help/command/macro.rst6
-rw-r--r--Help/command/option.rst2
-rw-r--r--Help/command/set_property.rst13
-rw-r--r--Help/command/set_source_files_properties.rst13
-rw-r--r--Help/command/source_group.rst6
-rw-r--r--Help/command/target_compile_options.rst2
-rw-r--r--Help/command/try_compile.rst1
-rw-r--r--Help/dev/source.rst15
-rw-r--r--Help/envvar/ASM_DIALECTFLAGS.rst2
-rw-r--r--Help/envvar/CFLAGS.rst2
-rw-r--r--Help/envvar/CSFLAGS.rst2
-rw-r--r--Help/envvar/CUDAFLAGS.rst2
-rw-r--r--Help/envvar/CXXFLAGS.rst2
-rw-r--r--Help/envvar/FFLAGS.rst2
-rw-r--r--Help/envvar/OBJC.rst14
-rw-r--r--Help/envvar/OBJCXX.rst14
-rw-r--r--Help/envvar/RCFLAGS.rst2
-rw-r--r--Help/guide/user-interaction/index.rst5
-rw-r--r--Help/manual/cmake-commands.7.rst2
-rw-r--r--Help/manual/cmake-env-variables.7.rst2
-rw-r--r--Help/manual/cmake-properties.7.rst4
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/manual/cmake.1.rst6
-rw-r--r--Help/prop_sf/COMPILE_OPTIONS.rst21
-rw-r--r--Help/prop_sf/Fortran_FORMAT.rst10
-rw-r--r--Help/prop_sf/Fortran_PREPROCESS.rst17
-rw-r--r--Help/prop_sf/OBJECT_OUTPUTS.rst3
-rw-r--r--Help/prop_sf/UNITY_GROUP.rst5
-rw-r--r--Help/prop_tgt/CUDA_RUNTIME_LIBRARY.rst4
-rw-r--r--Help/prop_tgt/CUDA_STANDARD.rst2
-rw-r--r--Help/prop_tgt/Fortran_PREPROCESS.rst23
-rw-r--r--Help/prop_tgt/INSTALL_RPATH.rst4
-rw-r--r--Help/prop_tgt/UNITY_BUILD.rst24
-rw-r--r--Help/prop_tgt/UNITY_BUILD_MODE.rst58
-rw-r--r--Help/release/3.16.rst13
-rw-r--r--Help/release/3.17.rst13
-rw-r--r--Help/release/dev/FindPython-IronPython-support.rst5
-rw-r--r--Help/release/dev/FindPython-pypy.rst5
-rw-r--r--Help/release/dev/cmake_command-command.rst6
-rw-r--r--Help/release/dev/cmake_language-command.rst6
-rw-r--r--Help/release/dev/ctest-log-environment.rst8
-rw-r--r--Help/release/dev/cuda-clang.rst4
-rw-r--r--Help/release/dev/fetchcontent-SOURCE_SUBDIR.rst6
-rw-r--r--Help/release/dev/fortran-preprocess-property.rst6
-rw-r--r--Help/release/dev/genex-OBJECT_OUTPUTS.rst4
-rw-r--r--Help/release/dev/grouped-unity-build-mode.rst6
-rw-r--r--Help/release/dev/sf-property-scopes.rst15
-rw-r--r--Help/release/dev/source_group_forward_slashes.rst5
-rw-r--r--Help/variable/CMAKE_CUDA_RUNTIME_LIBRARY.rst5
-rw-r--r--Help/variable/CMAKE_Fortran_PREPROCESS.rst8
-rw-r--r--Help/variable/CMAKE_LANG_FLAGS_INIT.rst6
-rw-r--r--Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst34
-rw-r--r--Modules/CMakeCUDACompiler.cmake.in2
-rw-r--r--Modules/CMakeCUDAInformation.cmake27
-rw-r--r--Modules/CMakeCompilerIdDetection.cmake3
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake98
-rw-r--r--Modules/CMakeDetermineCompiler.cmake3
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake6
-rw-r--r--Modules/CMakeDetermineOBJCCompiler.cmake21
-rw-r--r--Modules/CMakeDetermineOBJCXXCompiler.cmake21
-rw-r--r--Modules/CMakeGenericSystem.cmake8
-rw-r--r--Modules/CMakeTestCUDACompiler.cmake35
-rw-r--r--Modules/CheckLanguage.cmake2
-rw-r--r--Modules/Compiler/Absoft-Fortran.cmake2
-rw-r--r--Modules/Compiler/Clang-CUDA.cmake25
-rw-r--r--Modules/Compiler/Cray-Fortran.cmake8
-rw-r--r--Modules/Compiler/Flang-Fortran.cmake3
-rw-r--r--Modules/Compiler/G95-Fortran.cmake2
-rw-r--r--Modules/Compiler/GNU-Fortran.cmake5
-rw-r--r--Modules/Compiler/HP-Fortran.cmake3
-rw-r--r--Modules/Compiler/Intel-Fortran.cmake2
-rw-r--r--Modules/Compiler/NAG-Fortran.cmake1
-rw-r--r--Modules/Compiler/NVIDIA-CUDA.cmake5
-rw-r--r--Modules/Compiler/PGI-Fortran.cmake1
-rw-r--r--Modules/Compiler/PathScale-Fortran.cmake3
-rw-r--r--Modules/Compiler/SunPro-Fortran.cmake2
-rw-r--r--Modules/Compiler/XL-Fortran.cmake5
-rw-r--r--Modules/ExternalProject.cmake4
-rw-r--r--Modules/FetchContent.cmake70
-rw-r--r--Modules/FindBoost.cmake8
-rw-r--r--Modules/FindCUDAToolkit.cmake226
-rw-r--r--Modules/FindDoxygen.cmake8
-rw-r--r--Modules/FindGTK2.cmake9
-rw-r--r--Modules/FindHDF5.cmake476
-rw-r--r--Modules/FindOpenSSL.cmake47
-rw-r--r--Modules/FindPkgConfig.cmake48
-rw-r--r--Modules/FindPython.cmake22
-rw-r--r--Modules/FindPython/Support.cmake632
-rw-r--r--Modules/FindPython2.cmake22
-rw-r--r--Modules/FindPython3.cmake22
-rw-r--r--Modules/FindSquish.cmake64
-rw-r--r--Modules/FindVulkan.cmake23
-rw-r--r--Modules/GoogleTestAddTests.cmake20
-rw-r--r--Modules/Internal/CUDAToolkit.cmake225
-rw-r--r--Modules/Platform/DOS-OpenWatcom-C.cmake1
-rw-r--r--Modules/Platform/DOS-OpenWatcom-CXX.cmake1
-rw-r--r--Modules/Platform/DOS-OpenWatcom.cmake28
-rw-r--r--Modules/Platform/DOS.cmake14
-rw-r--r--Modules/Platform/Linux-OpenWatcom.cmake17
-rw-r--r--Modules/Platform/OS2-OpenWatcom-C.cmake1
-rw-r--r--Modules/Platform/OS2-OpenWatcom-CXX.cmake1
-rw-r--r--Modules/Platform/OS2-OpenWatcom.cmake35
-rw-r--r--Modules/Platform/OS2.cmake14
-rw-r--r--Modules/Platform/UnixPaths.cmake11
-rw-r--r--Modules/Platform/Windows-MSVC.cmake12
-rw-r--r--Modules/Platform/Windows-NVIDIA-CUDA.cmake5
-rw-r--r--Modules/Platform/Windows-OpenWatcom.cmake13
-rw-r--r--Modules/Platform/WindowsPaths.cmake4
-rwxr-xr-xModules/Squish4RunTestCase.bat3
-rwxr-xr-xModules/Squish4RunTestCase.sh9
-rw-r--r--Modules/SquishTestScript.cmake5
-rw-r--r--Source/CMakeLists.txt6
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/WiX/cmWIXPatchParser.cxx2
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.cxx2
-rw-r--r--Source/CPack/cmCPackExternalGenerator.cxx6
-rw-r--r--Source/CTest/cmCTestBZR.cxx4
-rw-r--r--Source/CTest/cmCTestCurl.h2
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx8
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.h3
-rw-r--r--Source/CTest/cmCTestResourceSpec.cxx6
-rw-r--r--Source/CTest/cmCTestRunTest.cxx34
-rw-r--r--Source/CTest/cmCTestRunTest.h2
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx6
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx6
-rw-r--r--Source/CTest/cmCTestTestHandler.h1
-rw-r--r--Source/CTest/cmProcess.cxx2
-rw-r--r--Source/CTest/cmProcess.h3
-rw-r--r--Source/CursesDialog/cmCursesLongMessageForm.cxx2
-rw-r--r--Source/bindexplib.cxx12
-rw-r--r--Source/cmAffinity.cxx2
-rw-r--r--Source/cmAlgorithms.h2
-rw-r--r--Source/cmArchiveWrite.cxx4
-rw-r--r--Source/cmCMakeCommand.cxx68
-rw-r--r--Source/cmCMakeLanguageCommand.cxx111
-rw-r--r--Source/cmCMakeLanguageCommand.h (renamed from Source/cmCMakeCommand.h)10
-rw-r--r--Source/cmCTest.cxx6
-rw-r--r--Source/cmCommands.cxx4
-rw-r--r--Source/cmCommonTargetGenerator.cxx28
-rw-r--r--Source/cmCommonTargetGenerator.h3
-rw-r--r--Source/cmComputeLinkInformation.cxx39
-rw-r--r--Source/cmConnection.cxx11
-rw-r--r--Source/cmConnection.h2
-rw-r--r--Source/cmCoreTryCompile.cxx3
-rw-r--r--Source/cmCryptoHash.cxx6
-rw-r--r--Source/cmCurl.h2
-rw-r--r--Source/cmELF.cxx6
-rw-r--r--Source/cmExportBuildAndroidMKGenerator.cxx4
-rw-r--r--Source/cmExportFileGenerator.cxx10
-rw-r--r--Source/cmExportTryCompileFileGenerator.cxx2
-rw-r--r--Source/cmExprParserHelper.h2
-rw-r--r--Source/cmFileAPI.h6
-rw-r--r--Source/cmFileAPICMakeFiles.cxx2
-rw-r--r--Source/cmFileAPICMakeFiles.h2
-rw-r--r--Source/cmFileAPICache.cxx2
-rw-r--r--Source/cmFileAPICache.h2
-rw-r--r--Source/cmFileAPICodemodel.cxx2
-rw-r--r--Source/cmFileAPICodemodel.h2
-rw-r--r--Source/cmFileCommand.cxx18
-rw-r--r--Source/cmFileMonitor.h2
-rw-r--r--Source/cmFindPackageCommand.h2
-rw-r--r--Source/cmGeneratedFileStream.cxx3
-rw-r--r--Source/cmGeneratorTarget.cxx244
-rw-r--r--Source/cmGeneratorTarget.h41
-rw-r--r--Source/cmGetPipes.cxx3
-rw-r--r--Source/cmGetPropertyCommand.cxx61
-rw-r--r--Source/cmGetSourceFilePropertyCommand.cxx52
-rw-r--r--Source/cmGlobalGenerator.cxx10
-rw-r--r--Source/cmGlobalGenerator.h4
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx8
-rw-r--r--Source/cmGlobalNinjaGenerator.h5
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx4
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx1
-rw-r--r--Source/cmGlobalWatcomWMakeGenerator.cxx10
-rw-r--r--Source/cmGlobalWatcomWMakeGenerator.h3
-rw-r--r--Source/cmJsonObjects.h2
-rw-r--r--Source/cmLinkItem.h6
-rw-r--r--Source/cmLocalGenerator.cxx186
-rw-r--r--Source/cmLocalGenerator.h2
-rw-r--r--Source/cmLocalNinjaGenerator.cxx37
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx2
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx30
-rw-r--r--Source/cmMakefile.cxx25
-rw-r--r--Source/cmMakefileProfilingData.cxx6
-rw-r--r--Source/cmMakefileTargetGenerator.cxx12
-rw-r--r--Source/cmMathCommand.cxx2
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx2
-rw-r--r--Source/cmNinjaTargetGenerator.cxx379
-rw-r--r--Source/cmNinjaTargetGenerator.h4
-rw-r--r--Source/cmNinjaUtilityTargetGenerator.cxx5
-rw-r--r--Source/cmOutputConverter.cxx11
-rw-r--r--Source/cmOutputConverter.h8
-rw-r--r--Source/cmPipeConnection.h2
-rw-r--r--Source/cmPropertyDefinition.cxx39
-rw-r--r--Source/cmPropertyDefinition.h36
-rw-r--r--Source/cmPropertyDefinitionMap.cxx35
-rw-r--r--Source/cmPropertyDefinitionMap.h30
-rw-r--r--Source/cmQtAutoGenInitializer.cxx6
-rw-r--r--Source/cmQtAutoGenerator.cxx4
-rw-r--r--Source/cmQtAutoGenerator.h2
-rw-r--r--Source/cmQtAutoMocUic.cxx4
-rw-r--r--Source/cmServer.cxx7
-rw-r--r--Source/cmServer.h4
-rw-r--r--Source/cmServerConnection.cxx2
-rw-r--r--Source/cmServerProtocol.cxx2
-rw-r--r--Source/cmServerProtocol.h2
-rw-r--r--Source/cmSetDirectoryPropertiesCommand.cxx40
-rw-r--r--Source/cmSetPropertyCommand.cxx197
-rw-r--r--Source/cmSetPropertyCommand.h29
-rw-r--r--Source/cmSetSourceFilesPropertiesCommand.cxx170
-rw-r--r--Source/cmSetTargetPropertiesCommand.cxx70
-rw-r--r--Source/cmSetTestsPropertiesCommand.cxx75
-rw-r--r--Source/cmStandardLexer.h2
-rw-r--r--Source/cmState.cxx30
-rw-r--r--Source/cmState.h8
-rw-r--r--Source/cmSystemTools.cxx5
-rw-r--r--Source/cmTarget.cxx6
-rw-r--r--Source/cmTarget.h8
-rw-r--r--Source/cmTestGenerator.cxx14
-rw-r--r--Source/cmUVHandlePtr.cxx2
-rw-r--r--Source/cmUVHandlePtr.h2
-rw-r--r--Source/cmUVProcessChain.cxx2
-rw-r--r--Source/cmUVProcessChain.h2
-rw-r--r--Source/cmUVSignalHackRAII.h2
-rw-r--r--Source/cmUVStreambuf.h2
-rw-r--r--Source/cmVSSetupHelper.h3
-rw-r--r--Source/cmVersion.h2
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx230
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h11
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx28
-rw-r--r--Source/cmVisualStudioGeneratorOptions.h1
-rw-r--r--Source/cmWorkerPool.cxx71
-rw-r--r--Source/cmXCodeScheme.cxx3
-rw-r--r--Source/cmXMLParser.cxx4
-rw-r--r--Source/cmake.cxx12
-rw-r--r--Source/cmake.h2
-rw-r--r--Source/cmakemain.cxx8
-rw-r--r--Source/cmcmd.cxx3
-rw-r--r--Source/kwsys/CommandLineArguments.cxx6
-rw-r--r--Source/kwsys/Directory.cxx35
-rw-r--r--Source/kwsys/Directory.hxx.in5
-rw-r--r--Source/kwsys/EncodingCXX.cxx4
-rw-r--r--Source/kwsys/Glob.cxx20
-rw-r--r--Source/kwsys/Glob.hxx.in1
-rw-r--r--Source/kwsys/RegularExpression.cxx7
-rw-r--r--Source/kwsys/SystemInformation.cxx26
-rw-r--r--Source/kwsys/SystemTools.cxx37
-rw-r--r--Source/kwsys/SystemTools.hxx.in3
-rw-r--r--Source/kwsys/testCommandLineArguments.cxx4
-rw-r--r--Source/kwsys/testCommandLineArguments1.cxx8
-rw-r--r--Source/kwsys/testDirectory.cxx37
-rw-r--r--Source/kwsys/testDynload.c2
-rw-r--r--Source/kwsys/testEncoding.cxx8
-rw-r--r--Source/kwsys/testFStream.cxx2
-rw-r--r--Source/kwsys/testSystemTools.cxx16
-rw-r--r--Tests/CMakeLib/testUVProcessChain.cxx2
-rw-r--r--Tests/CMakeLib/testUVRAII.cxx2
-rw-r--r--Tests/CMakeLib/testUVStreambuf.cxx3
-rw-r--r--Tests/CMakeLists.txt7
-rw-r--r--Tests/CMakeOnly/CheckLanguage/CMakeLists.txt18
-rw-r--r--Tests/CPackWiXGenerator/myotherapp.cpp2
-rw-r--r--Tests/ConfigSources/CMakeLists.txt59
-rw-r--r--Tests/ConfigSources/main.cpp9
-rw-r--r--Tests/Cuda/CMakeLists.txt11
-rw-r--r--Tests/Cuda/ProperLinkFlags/CMakeLists.txt8
-rw-r--r--Tests/CudaOnly/CMakeLists.txt39
-rw-r--r--Tests/CudaOnly/CompileFlags/CMakeLists.txt9
-rw-r--r--Tests/CudaOnly/CompileFlags/main.cu7
-rw-r--r--Tests/CudaOnly/ExportPTX/CMakeLists.txt7
-rw-r--r--Tests/CudaOnly/GPUDebugFlag/CMakeLists.txt15
-rw-r--r--Tests/CudaOnly/SharedRuntimeViaCUDAFlags/CMakeLists.txt15
-rw-r--r--Tests/CudaOnly/SharedRuntimeViaCUDAFlags/main.cu5
-rw-r--r--Tests/CudaOnly/WithDefs/CMakeLists.txt2
-rw-r--r--Tests/CudaOnly/WithDefs/main.notcu6
-rw-r--r--Tests/FindDoxygen/SimpleTest/CMakeLists.txt2
-rw-r--r--Tests/FindDoxygen/StampFile/CMakeLists.txt29
-rw-r--r--Tests/FindPython/CMakeLists.txt198
-rw-r--r--Tests/FindPython/ExactVersion/CMakeLists.txt56
-rw-r--r--Tests/FindPython/PyPy/CMakeLists.txt37
-rw-r--r--Tests/FindPython/PyPy2/CMakeLists.txt37
-rw-r--r--Tests/FindPython/PyPy3/CMakeLists.txt37
-rw-r--r--Tests/FortranOnly/CMakeLists.txt43
-rw-r--r--Tests/FortranOnly/no_preprocess_source_fpp.fpp3
-rw-r--r--Tests/FortranOnly/no_preprocess_source_lower.f3
-rw-r--r--Tests/FortranOnly/no_preprocess_source_upper.F3
-rw-r--r--Tests/FortranOnly/no_preprocess_target_fpp.fpp3
-rw-r--r--Tests/FortranOnly/no_preprocess_target_lower.f3
-rw-r--r--Tests/FortranOnly/no_preprocess_target_upper.F3
-rw-r--r--Tests/FortranOnly/preprocess2.f4
-rw-r--r--Tests/FortranOnly/preprocess3.f4
-rw-r--r--Tests/Properties/CMakeLists.txt139
-rw-r--r--Tests/Properties/SubDir2/CMakeLists.txt25
-rw-r--r--Tests/QtAutogen/Complex/codeeditor.cpp5
-rw-r--r--Tests/RunCMake/AndroidTestUtilities/check.cmake2
-rw-r--r--Tests/RunCMake/AutoExportDll/AutoExport.cmake6
-rw-r--r--Tests/RunCMake/AutoExportDll/cppCLI.cxx22
-rw-r--r--Tests/RunCMake/AutoExportDll/say.cxx8
-rw-r--r--Tests/RunCMake/BuildDepends/ExternalProject/CMakeLists.txt14
-rw-r--r--Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build1-stdout.txt2
-rw-r--r--Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build2-stdout.txt2
-rw-r--r--Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.cmake19
-rw-r--r--Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step1.cmake3
-rw-r--r--Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step2.cmake3
-rw-r--r--Tests/RunCMake/BuildDepends/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/CMP0104/CMP0104-WARN.cmake1
-rw-r--r--Tests/RunCMake/CMakeLists.txt7
-rw-r--r--Tests/RunCMake/CTestResourceAllocation/RunCMakeTest.cmake7
-rw-r--r--Tests/RunCMake/CTestResourceAllocation/process_count-ctest-s-nores-check.cmake4
-rw-r--r--Tests/RunCMake/CTestResourceAllocation/process_count-ctest-s-res-check.cmake8
-rw-r--r--Tests/RunCMake/CommandLine/P_arbitrary_args.cmake3
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.hbin58 -> 59 bytes
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake10
-rw-r--r--Tests/RunCMake/ExportCompileCommands/BeforeProject-check.cmake4
-rw-r--r--Tests/RunCMake/ExportCompileCommands/BeforeProject.cmake3
-rw-r--r--Tests/RunCMake/ExportCompileCommands/BeforeProjectBEFORE.cmake1
-rw-r--r--Tests/RunCMake/ExportCompileCommands/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/ExportCompileCommands/empty.c0
-rw-r--r--Tests/RunCMake/FetchContent/MakeAvailable-stdout.txt1
-rw-r--r--Tests/RunCMake/FetchContent/MakeAvailable.cmake13
-rw-r--r--Tests/RunCMake/FetchContent/WithoutProject/ProjectSubdir/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake22
-rw-r--r--Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake8
-rw-r--r--Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt40
-rw-r--r--Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt44
-rw-r--r--Tests/RunCMake/GoogleTest/fake_gtest.cpp4
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/Install-all-install-ninja-check.cmake39
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/Install-default-install-ninja-check.cmake31
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake9
-rw-r--r--Tests/RunCMake/ObjectLibrary/b.c2
-rw-r--r--Tests/RunCMake/ObjectLibrary/requires.c2
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchInterface.cmake3
-rw-r--r--Tests/RunCMake/PrecompileHeaders/empty.c2
-rw-r--r--Tests/RunCMake/UnityBuild/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/UnityBuild/f.c5
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_group-check.cmake42
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_group.cmake39
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_c_batch-check.cmake5
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_c_batch.cmake15
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_c_group-check.cmake11
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_c_group.cmake17
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_c_no_unity_build_group-check.cmake5
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_c_no_unity_build_group.cmake16
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_cxx_group-check.cmake27
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_cxx_group.cmake27
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_invalid_mode-result.txt (renamed from Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation-result.txt)0
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_invalid_mode-stderr.txt5
-rw-r--r--Tests/RunCMake/UnityBuild/unitybuild_invalid_mode.cmake12
-rw-r--r--Tests/RunCMake/VS10Project/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/VS10Project/UnityBuildNativeGrouped-check.cmake56
-rw-r--r--Tests/RunCMake/VS10Project/UnityBuildNativeGrouped.cmake20
-rw-r--r--Tests/RunCMake/VS10Project/UnityBuildPre2017Grouped-check.cmake59
-rw-r--r--Tests/RunCMake/VS10Project/UnityBuildPre2017Grouped.cmake20
-rw-r--r--Tests/RunCMake/add_test/CMakeLists.txt.in27
-rw-r--r--Tests/RunCMake/add_test/NameContainsBracketArgument1-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsBracketArgument2-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsBracketArgument3-result.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsBracketArgument3-stderr.txt2
-rw-r--r--Tests/RunCMake/add_test/NameContainsBracketArgument4-result.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsBracketArgument4-stderr.txt2
-rw-r--r--Tests/RunCMake/add_test/NameContainsEscapedQuote1-result.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsEscapedQuote1-stderr.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsEscapedQuote1-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsEscapedQuote2-result.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsEscapedQuote2-stderr.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsEscapedQuote2-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsEscapedQuote3-result.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsEscapedQuote3-stderr.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsEscapedQuote3-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsEscapedQuote4-result.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsEscapedQuote4-stderr.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsEscapedQuote4-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsEscapedSpecialChars1-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsEscapedSpecialChars2-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsEscapedSpecialChars3-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsEscapedSpecialChars4-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax1-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax2-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax3-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax4-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsOtherSpecialChars1-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsOtherSpecialChars2-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsOtherSpecialChars3-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsOtherSpecialChars4-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsSemicolon1-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsSemicolon2-result.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsSemicolon2-stderr.txt2
-rw-r--r--Tests/RunCMake/add_test/NameContainsSemicolon3-stdout.txt3
-rw-r--r--Tests/RunCMake/add_test/NameContainsSemicolon4-result.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsSemicolon4-stderr.txt2
-rw-r--r--Tests/RunCMake/add_test/NameContainsSpaces1-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsSpaces2-result.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsSpaces2-stderr.txt2
-rw-r--r--Tests/RunCMake/add_test/NameContainsSpaces3-stdout.txt3
-rw-r--r--Tests/RunCMake/add_test/NameContainsSpaces4-result.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsSpaces4-stderr.txt2
-rw-r--r--Tests/RunCMake/add_test/NameContainsValidSpecialChars1-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsValidSpecialChars2-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsValidSpecialChars3-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameContainsValidSpecialChars4-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameIsAlphaNumeric1-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameIsAlphaNumeric2-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameIsAlphaNumeric3-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/NameIsAlphaNumeric4-stdout.txt1
-rw-r--r--Tests/RunCMake/add_test/RunCMakeTest.cmake263
-rw-r--r--Tests/RunCMake/add_test/test.cmake.in16
-rw-r--r--Tests/RunCMake/cmake_command/RunCMakeTest.cmake13
-rw-r--r--Tests/RunCMake/cmake_command/cmake_command_eval_message.cmake1
-rw-r--r--Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-stderr.txt5
-rw-r--r--Tests/RunCMake/cmake_command/cmake_command_eval_no_code-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_command/cmake_command_eval_no_code.cmake1
-rw-r--r--Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters.cmake1
-rw-r--r--Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message.cmake2
-rw-r--r--Tests/RunCMake/cmake_command/cmake_command_invoke_message.cmake1
-rw-r--r--Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error-stderr.txt5
-rw-r--r--Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error.cmake1
-rw-r--r--Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters.cmake1
-rw-r--r--Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function.cmake1
-rw-r--r--Tests/RunCMake/cmake_command/cmake_command_no_parameters-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_command/cmake_command_no_parameters.cmake1
-rw-r--r--Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation.cmake1
-rw-r--r--Tests/RunCMake/cmake_language/CMakeLists.txt (renamed from Tests/RunCMake/cmake_command/CMakeLists.txt)0
-rw-r--r--Tests/RunCMake/cmake_language/RunCMakeTest.cmake23
-rw-r--r--Tests/RunCMake/cmake_language/call_double_evaluation-stderr.txt1
-rw-r--r--Tests/RunCMake/cmake_language/call_double_evaluation.cmake2
-rw-r--r--Tests/RunCMake/cmake_language/call_expand_command_name-stderr.txt1
-rw-r--r--Tests/RunCMake/cmake_language/call_expand_command_name.cmake2
-rw-r--r--Tests/RunCMake/cmake_language/call_expand_function_name-stderr.txt (renamed from Tests/RunCMake/cmake_command/cmake_command_no_parameters-result.txt)0
-rw-r--r--Tests/RunCMake/cmake_language/call_expand_function_name.cmake11
-rw-r--r--Tests/RunCMake/cmake_language/call_expanded_command-stderr.txt1
-rw-r--r--Tests/RunCMake/cmake_language/call_expanded_command.cmake6
-rw-r--r--Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-result.txt (renamed from Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function-result.txt)0
-rw-r--r--Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-stderr.txt4
-rw-r--r--Tests/RunCMake/cmake_language/call_expanded_command_and_arguments.cmake2
-rw-r--r--Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument-stderr.txt1
-rw-r--r--Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument.cmake2
-rw-r--r--Tests/RunCMake/cmake_language/call_message-stderr.txt (renamed from Tests/RunCMake/cmake_command/cmake_command_invoke_message-stderr.txt)0
-rw-r--r--Tests/RunCMake/cmake_language/call_message.cmake1
-rw-r--r--Tests/RunCMake/cmake_language/call_message_fatal_error-result.txt (renamed from Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters-result.txt)0
-rw-r--r--Tests/RunCMake/cmake_language/call_message_fatal_error-stderr.txt5
-rw-r--r--Tests/RunCMake/cmake_language/call_message_fatal_error.cmake1
-rw-r--r--Tests/RunCMake/cmake_language/call_no_parameters-result.txt (renamed from Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error-result.txt)0
-rw-r--r--Tests/RunCMake/cmake_language/call_no_parameters-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_language/call_no_parameters.cmake1
-rw-r--r--Tests/RunCMake/cmake_language/call_preserve_arguments-stderr.txt6
-rw-r--r--Tests/RunCMake/cmake_language/call_preserve_arguments.cmake12
-rw-r--r--Tests/RunCMake/cmake_language/call_unknown_function-result.txt (renamed from Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-result.txt)0
-rw-r--r--Tests/RunCMake/cmake_language/call_unknown_function-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_language/call_unknown_function.cmake1
-rw-r--r--Tests/RunCMake/cmake_language/eval_expand_command_name-stderr.txt1
-rw-r--r--Tests/RunCMake/cmake_language/eval_expand_command_name.cmake2
-rw-r--r--Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments-stderr.txt1
-rw-r--r--Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments.cmake2
-rw-r--r--Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-result.txt (renamed from Tests/RunCMake/cmake_command/cmake_command_eval_no_code-result.txt)0
-rw-r--r--Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-stderr.txt5
-rw-r--r--Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code.cmake1
-rw-r--r--Tests/RunCMake/cmake_language/eval_message-stderr.txt (renamed from Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message-stderr.txt)0
-rw-r--r--Tests/RunCMake/cmake_language/eval_message.cmake1
-rw-r--r--Tests/RunCMake/cmake_language/eval_message_fatal_error-result.txt (renamed from Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-result.txt)0
-rw-r--r--Tests/RunCMake/cmake_language/eval_message_fatal_error-stderr.txt5
-rw-r--r--Tests/RunCMake/cmake_language/eval_message_fatal_error.cmake (renamed from Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error.cmake)2
-rw-r--r--Tests/RunCMake/cmake_language/eval_no_code-result.txt1
-rw-r--r--Tests/RunCMake/cmake_language/eval_no_code-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_language/eval_no_code.cmake1
-rw-r--r--Tests/RunCMake/cmake_language/eval_no_parameters-result.txt1
-rw-r--r--Tests/RunCMake/cmake_language/eval_no_parameters-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_language/eval_no_parameters.cmake1
-rw-r--r--Tests/RunCMake/cmake_language/eval_variable_outside_message-stderr.txt (renamed from Tests/RunCMake/cmake_command/cmake_command_eval_message-stderr.txt)0
-rw-r--r--Tests/RunCMake/cmake_language/eval_variable_outside_message.cmake2
-rw-r--r--Tests/RunCMake/cmake_language/no_parameters-result.txt1
-rw-r--r--Tests/RunCMake/cmake_language/no_parameters-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_language/no_parameters.cmake1
-rw-r--r--Tests/RunCMake/cmake_language/unknown_meta_operation-result.txt1
-rw-r--r--Tests/RunCMake/cmake_language/unknown_meta_operation-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_language/unknown_meta_operation.cmake1
-rw-r--r--Tests/RunCMake/ctest_test/RunCMakeTest.cmake11
-rw-r--r--Tests/RunCMake/ctest_test/TestEnvironment-check.cmake10
-rw-r--r--Tests/RunCMake/get_property/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/get_property/source_properties_failures-result.txt1
-rw-r--r--Tests/RunCMake/get_property/source_properties_failures-stderr.txt66
-rw-r--r--Tests/RunCMake/get_property/source_properties_failures.cmake14
-rw-r--r--Tests/RunCMake/install/RunCMakeTest.cmake7
-rw-r--r--Tests/RunCMake/set_property/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/set_property/SOURCE_FILE-result.txt1
-rw-r--r--Tests/RunCMake/set_property/SOURCE_FILE-stderr.txt22
-rw-r--r--Tests/RunCMake/set_property/SOURCE_FILE.cmake4
-rw-r--r--Tests/RunCMake/target_link_options/RunCMakeTest.cmake12
-rw-r--r--Tests/SourceGroups/CMakeLists.txt6
-rw-r--r--Tests/SourceGroups/main.c4
-rw-r--r--Tests/SourceGroups/nested.c4
-rw-r--r--Tests/VSWindowsFormsResx/WindowsFormsResx/MyForm.cpp2
-rw-r--r--Utilities/IWYU/mapping.imp59
-rw-r--r--Utilities/Release/.gitattributes1
-rw-r--r--Utilities/Release/README.rst46
-rw-r--r--Utilities/Release/create-cmake-release.cmake4
-rw-r--r--Utilities/Release/linux/x86_64/test/cache-ninja.txt4
-rw-r--r--Utilities/Release/win/x86/Dockerfile23
-rw-r--r--Utilities/Release/win/x86/base/Dockerfile30
-rwxr-xr-xUtilities/Release/win/x86/base/msvc-i386.bat1
-rwxr-xr-xUtilities/Release/win/x86/base/msvc-x86_64.bat1
-rwxr-xr-xUtilities/Release/win/x86/build.bat19
-rw-r--r--Utilities/Release/win/x86/cache-i386.txt45
-rw-r--r--Utilities/Release/win/x86/cache-x86_64.txt45
-rw-r--r--Utilities/Release/win/x86/deps/Dockerfile127
-rwxr-xr-xUtilities/Release/win/x86/deps/qt-build.bat47
-rw-r--r--Utilities/Release/win/x86/deps/qt-install.patch26
-rwxr-xr-xUtilities/Release/win/x86/pack.bat12
-rw-r--r--Utilities/Release/win/x86/test/Dockerfile37
-rwxr-xr-xUtilities/Release/win/x86/test/test-ninja.bat19
-rwxr-xr-xUtilities/Release/win/x86/test/test-nmake.bat19
-rw-r--r--Utilities/Release/win32_release.cmake53
-rw-r--r--Utilities/Release/win64_release.cmake53
-rw-r--r--Utilities/Sphinx/CMakeLists.txt2
-rw-r--r--Utilities/Sphinx/CTestConfig.cmake14
-rw-r--r--Utilities/cm3p/Setup.Configuration.h8
-rw-r--r--Utilities/cm3p/archive.h (renamed from Utilities/cm_libarchive.h)10
-rw-r--r--Utilities/cm3p/archive_entry.h14
-rw-r--r--Utilities/cm3p/bzlib.h (renamed from Utilities/cm_bzlib.h)8
-rw-r--r--Utilities/cm3p/curl/curl.h (renamed from Utilities/cm_curl.h)8
-rw-r--r--Utilities/cm3p/expat.h (renamed from Utilities/cm_expat.h)8
-rw-r--r--Utilities/cm3p/json/reader.h (renamed from Utilities/cm_jsoncpp_writer.h)8
-rw-r--r--Utilities/cm3p/json/value.h (renamed from Utilities/cm_jsoncpp_value.h)8
-rw-r--r--Utilities/cm3p/json/writer.h (renamed from Utilities/cm_jsoncpp_reader.h)8
-rw-r--r--Utilities/cm3p/kwiml/abi.h (renamed from Utilities/cm_kwiml.h)10
-rw-r--r--Utilities/cm3p/kwiml/int.h14
-rw-r--r--Utilities/cm3p/lzma.h (renamed from Utilities/cm_lzma.h)8
-rw-r--r--Utilities/cm3p/rhash.h (renamed from Utilities/cm_rhash.h)8
-rw-r--r--Utilities/cm3p/uv.h (renamed from Utilities/cm_uv.h)8
-rw-r--r--Utilities/cm3p/zlib.h (renamed from Utilities/cm_zlib.h)8
-rw-r--r--Utilities/cm3p/zstd.h (renamed from Utilities/cm_zstd.h)8
-rw-r--r--Utilities/cmcurl/CMake/OtherTests.cmake17
-rw-r--r--Utilities/cmexpat/lib/siphash.h2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_filter_bzip2.c2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_filter_gzip.c2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_filter_lzop.c2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_filter_xz.c2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_filter_zstd.c2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c6
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_cab.c2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_iso9660.c2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_rar.c2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_rar5.c2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_xar.c6
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_util.c6
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_version_details.c8
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_add_filter_bzip2.c2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_add_filter_gzip.c2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_add_filter_xz.c2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_add_filter_zstd.c2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_disk_posix.c2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_set_format_7zip.c6
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_set_format_iso9660.c2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_set_format_xar.c6
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_set_format_zip.c2
-rw-r--r--Utilities/cmlibrhash/librhash/byte_order.h2
-rw-r--r--Utilities/cmlibrhash/librhash/ustd.h2
-rw-r--r--Utilities/cmnghttp2/cmakeconfig.h.in3
-rw-r--r--Utilities/cmzlib/CMakeLists.txt5
-rw-r--r--Utilities/std/cm/bits/string_view.cxx2
-rw-r--r--Utilities/std/cm/shared_mutex2
-rwxr-xr-xbootstrap137
585 files changed, 6939 insertions, 2538 deletions
diff --git a/.clang-format b/.clang-format
index 4bfce44..8c015ef 100644
--- a/.clang-format
+++ b/.clang-format
@@ -32,16 +32,18 @@ IncludeCategories:
Priority: 5
- Regex: '^(<|")Qt?[A-Z]'
Priority: 6
- - Regex: '^(<|")cmsys/'
+ - Regex: '^<cmtp/'
Priority: 7
- - Regex: '^(<|")cm_'
+ - Regex: '^(<|")cmsys/'
Priority: 8
- - Regex: '^(<|")cm[A-Z][^.]+\.h'
+ - Regex: '^(<|")cm_'
Priority: 9
+ - Regex: '^(<|")cm[A-Z][^.]+\.h'
+ Priority: 10
- Regex: '^<[^.]+\.h'
Priority: 4
- Regex: '^<'
Priority: 1
- Regex: '.*'
- Priority: 10
+ Priority: 11
...
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9a91d20..0a55ca3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,7 +4,7 @@
- tags@cmake/cmake
.fedora31: &fedora31
- image: "kitware/cmake:ci-fedora31-x86_64-2020-04-27"
+ image: "kitware/cmake:ci-fedora31-x86_64-2020-05-05"
variables:
GIT_CLONE_PATH: "$CI_BUILDS_DIR/gitlab-kitware-cmake ci"
@@ -29,6 +29,14 @@
CMAKE_CONFIGURATION: fedora31_tidy
CTEST_NO_WARNINGS_ALLOWED: 1
+.fedora31_sphinx: &fedora31_sphinx
+ extends: .fedora31
+
+ variables:
+ CMAKE_CONFIGURATION: fedora31_sphinx
+ CTEST_NO_WARNINGS_ALLOWED: 1
+ CTEST_SOURCE_SUBDIRECTORY: "Utilities/Sphinx"
+
before_script:
- .gitlab/ci/cmake.sh
- .gitlab/ci/ninja.sh
@@ -95,3 +103,23 @@ build:fedora31-tidy:
- "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_build.cmake"
- sccache --show-stats
interruptible: true
+
+build:fedora31-sphinx:
+ <<:
+ - *fedora31_sphinx
+ stage: build
+ only: *only_settings
+ tags:
+ - build
+ - docker
+ - linux
+ - linux-3.17 # Needed to be able to load Fedora's Qt libraries.
+
+ script:
+ - .gitlab/ci/sccache.sh
+ - sccache --start-server
+ - sccache --show-stats
+ - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_configure.cmake"
+ - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_build.cmake"
+ - sccache --show-stats
+ interruptible: true
diff --git a/.gitlab/ci/configure_fedora31_sphinx.cmake b/.gitlab/ci/configure_fedora31_sphinx.cmake
new file mode 100644
index 0000000..dfc9b8c
--- /dev/null
+++ b/.gitlab/ci/configure_fedora31_sphinx.cmake
@@ -0,0 +1,8 @@
+set(SPHINX_INFO ON CACHE BOOL "")
+set(SPHINX_MAN ON CACHE BOOL "")
+set(SPHINX_HTML ON CACHE BOOL "")
+set(SPHINX_SINGLEHTML ON CACHE BOOL "")
+set(SPHINX_QTHELP ON CACHE BOOL "")
+set(SPHINX_TEXT ON CACHE BOOL "")
+
+include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake")
diff --git a/.gitlab/ci/docker/fedora31/install_deps.sh b/.gitlab/ci/docker/fedora31/install_deps.sh
index 978fdbd..7f8da57 100755
--- a/.gitlab/ci/docker/fedora31/install_deps.sh
+++ b/.gitlab/ci/docker/fedora31/install_deps.sh
@@ -5,9 +5,15 @@ dnf install -y \
openssl-devel
# Install development tools.
-dnf install -y \
+dnf install --setopt=install_weak_deps=False -y \
clang-tools-extra \
gcc-c++ \
git-core
+# Install documentation tools.
+dnf install --setopt=install_weak_deps=False -y \
+ python3-sphinx \
+ texinfo \
+ qt5-qttools-devel
+
dnf clean all
diff --git a/.gitlab/ci/gitlab_ci.cmake b/.gitlab/ci/gitlab_ci.cmake
index 401cc40..b49f51d 100644
--- a/.gitlab/ci/gitlab_ci.cmake
+++ b/.gitlab/ci/gitlab_ci.cmake
@@ -5,6 +5,9 @@ endif ()
# Set up the source and build paths.
set(CTEST_SOURCE_DIRECTORY "$ENV{CI_PROJECT_DIR}")
+if (NOT "$ENV{CTEST_SOURCE_SUBDIRECTORY}" STREQUAL "")
+ string(APPEND CTEST_SOURCE_DIRECTORY "/$ENV{CTEST_SOURCE_SUBDIRECTORY}")
+endif ()
set(CTEST_BINARY_DIRECTORY "${CTEST_SOURCE_DIRECTORY}/build")
if ("$ENV{CMAKE_CONFIGURATION}" STREQUAL "")
diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim
index 0676f7e..2d63eb0 100644
--- a/Auxiliary/vim/syntax/cmake.vim
+++ b/Auxiliary/vim/syntax/cmake.vim
@@ -170,6 +170,7 @@ syn keyword cmakeProperty contained
\ FRAMEWORK_VERSION
\ Fortran_FORMAT
\ Fortran_MODULE_DIRECTORY
+ \ Fortran_PREPROCESS
\ GENERATED
\ GENERATOR_FILE_NAME
\ GENERATOR_IS_MULTI_CONFIG
@@ -1019,6 +1020,7 @@ syn keyword cmakeVariable contained
\ CMAKE_Fortran_MODULE_DIRECTORY
\ CMAKE_Fortran_OUTPUT_EXTENSION
\ CMAKE_Fortran_PLATFORM_ID
+ \ CMAKE_Fortran_PREPROCESS
\ CMAKE_Fortran_SIMULATE_ID
\ CMAKE_Fortran_SIMULATE_VERSION
\ CMAKE_Fortran_SIZEOF_DATA_PTR
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 32a483d..e6aaf60 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -376,10 +376,13 @@ macro (CMAKE_BUILD_UTILITIES)
include_directories(SYSTEM "${CMake_SOURCE_DIR}/Utilities/std")
endif()
- include_directories(
- ${CMake_BINARY_DIR}/Utilities
- ${CMake_SOURCE_DIR}/Utilities
- )
+ include_directories("${CMake_BINARY_DIR}/Utilities")
+ if ((CMAKE_SYSTEM_NAME STREQUAL "AIX" OR CMAKE_SYSTEM_NAME STREQUAL "OS400") AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ # using -isystem option generate error "template with C linkage"
+ include_directories("${CMake_SOURCE_DIR}/Utilities")
+ else()
+ include_directories(SYSTEM "${CMake_SOURCE_DIR}/Utilities")
+ endif()
#---------------------------------------------------------------------
# Build CMake std library for CMake and CTest.
@@ -826,7 +829,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
PATTERN "*.sh*" PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
- PATTERN "ExportImportList"
+ REGEX "/(ExportImportList|cpp)$"
PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 7983be1..3006214 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -11,11 +11,11 @@ Community
CMake is maintained and supported by `Kitware`_ and developed in
collaboration with a productive community of contributors.
-Please subscribe and post to the `CMake Developers List`_ to raise
+Please post to the ``Development`` category of the `CMake Forum`_ to raise
discussion of development topics.
.. _`Kitware`: http://www.kitware.com/cmake
-.. _`CMake Developers List`: https://cmake.org/mailman/listinfo/cmake-developers
+.. _`CMake Forum`: https://discourse.cmake.org
Patches
=======
diff --git a/CTestConfig.cmake b/CTestConfig.cmake
index 020582e..9ec9e8f 100644
--- a/CTestConfig.cmake
+++ b/CTestConfig.cmake
@@ -1,6 +1,8 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
+# If changing this file, also update Utilities/Sphinx/CTestConfig.cmake
+
set(CTEST_PROJECT_NAME "CMake")
set(CTEST_NIGHTLY_START_TIME "1:00:00 UTC")
diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in
index c3f3b7c..5b78f2e 100644
--- a/CTestCustom.cmake.in
+++ b/CTestCustom.cmake.in
@@ -64,6 +64,7 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
"ld: warning .*/libgcc.a archive's cputype"
"ld: warning: ignoring file .*/libgcc.a, file was built for archive which is not the architecture being linked"
"ld: warning: in .*/libgcc.a, file is not of required architecture"
+ "ld: warning: symbol .(deflate|inflate)_copyright. has differing sizes" # system libz and QtCore disagree
"warning.*This version of Mac OS X is unsupported"
"clang.*: warning: argument unused during compilation: .-g"
"note: in expansion of macro" # diagnostic context note
@@ -80,7 +81,7 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
"compilation completed with warnings" # PGI
"[0-9]+ Warning\\(s\\) detected" # SunPro
-# scanbuild exceptions
+ # scanbuild exceptions
"char_traits.h:.*: warning: Null pointer argument in call to string length function"
"stl_construct.h:.*: warning: Forming reference to null pointer"
".*stl_uninitialized.h:75:19: warning: Forming reference to null pointer.*"
diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt
index cebe051..4a62c5b 100644
--- a/Help/command/FIND_XXX.txt
+++ b/Help/command/FIND_XXX.txt
@@ -143,6 +143,10 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows:
* |CMAKE_SYSTEM_XXX_PATH|
* |CMAKE_SYSTEM_XXX_MAC_PATH|
+ The platform paths that these variables contain are locations that
+ typically include installed software. An example being ``/usr/local`` for
+ UNIX based platforms.
+
7. Search the paths specified by the PATHS option
or in the short-hand version of the command.
These are typically hard-coded guesses.
diff --git a/Help/command/add_compile_options.rst b/Help/command/add_compile_options.rst
index 43805c3..36f403c 100644
--- a/Help/command/add_compile_options.rst
+++ b/Help/command/add_compile_options.rst
@@ -46,3 +46,6 @@ to use the more specific commands :command:`add_compile_definitions`
and :command:`include_directories`.
The command :command:`target_compile_options` adds target-specific options.
+
+The source file property :prop_sf:`COMPILE_OPTIONS` adds options to one
+source file.
diff --git a/Help/command/add_test.rst b/Help/command/add_test.rst
index a77ba37..c0677d2 100644
--- a/Help/command/add_test.rst
+++ b/Help/command/add_test.rst
@@ -10,8 +10,9 @@ Add a test to the project to be run by :manual:`ctest(1)`.
[WORKING_DIRECTORY <dir>]
[COMMAND_EXPAND_LISTS])
-Adds a test called ``<name>``. The test name may not contain spaces,
-quotes, or other characters special in CMake syntax. The options are:
+Adds a test called ``<name>``. The test name may contain arbitrary
+characters except for double-quotes. However, if it contains spaces
+or semicolons it must be enclosed in double-quotes. The options are:
``COMMAND``
Specify the test command-line. If ``<command>`` specifies an
diff --git a/Help/command/cmake_command.rst b/Help/command/cmake_language.rst
index 08b7832..21f51a0 100644
--- a/Help/command/cmake_command.rst
+++ b/Help/command/cmake_language.rst
@@ -1,5 +1,5 @@
-cmake_command
--------------
+cmake_language
+--------------
Call meta-operations on CMake commands.
@@ -8,8 +8,8 @@ Synopsis
.. parsed-literal::
- cmake_command(`INVOKE`_ <command> [<args>...])
- cmake_command(`EVAL`_ CODE <code>...)
+ cmake_language(`CALL`_ <command> [<args>...])
+ cmake_language(`EVAL`_ CODE <code>...)
Introduction
^^^^^^^^^^^^
@@ -17,24 +17,24 @@ Introduction
This command will call meta-operations on built-in CMake commands or
those created via the :command:`macro` or :command:`function` commands.
-``cmake_command`` does not introduce a new variable or policy scope.
+``cmake_language`` does not introduce a new variable or policy scope.
-Invoking Commands
-^^^^^^^^^^^^^^^^^
+Calling Commands
+^^^^^^^^^^^^^^^^
-.. _INVOKE:
+.. _CALL:
.. code-block:: cmake
- cmake_command(INVOKE <command> [<args>...])
+ cmake_language(CALL <command> [<args>...])
-Invokes the named ``<command>`` with the given arguments (if any).
+Calls the named ``<command>`` with the given arguments (if any).
For example, the code:
.. code-block:: cmake
set(message_command "message")
- cmake_command(INVOKE ${message_command} STATUS "Hello World!")
+ cmake_language(CALL ${message_command} STATUS "Hello World!")
is equivalent to
@@ -49,7 +49,7 @@ Evaluating Code
.. code-block:: cmake
- cmake_command(EVAL CODE <code>...)
+ cmake_language(EVAL CODE <code>...)
Evaluates the ``<code>...`` as CMake code.
@@ -62,7 +62,7 @@ For example, the code:
set(C TRUE)
set(condition "(A AND B) OR C")
- cmake_command(EVAL CODE "
+ cmake_language(EVAL CODE "
if (${condition})
message(STATUS TRUE)
else()
diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst
index 6753268..dcc0225 100644
--- a/Help/command/find_package.rst
+++ b/Help/command/find_package.rst
@@ -329,9 +329,9 @@ enabled.
skipped if ``NO_SYSTEM_ENVIRONMENT_PATH`` is passed or by setting the
:variable:`CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH` to ``FALSE``. Path entries
ending in ``/bin`` or ``/sbin`` are automatically converted to their
- parent directories::
+ parent directories:
- PATH
+ * ``PATH``
6. Search paths stored in the CMake :ref:`User Package Registry`.
This can be skipped if ``NO_CMAKE_PACKAGE_REGISTRY`` is passed or by
@@ -345,11 +345,15 @@ enabled.
7. Search cmake variables defined in the Platform files for the
current system. This can be skipped if ``NO_CMAKE_SYSTEM_PATH`` is
passed or by setting the :variable:`CMAKE_FIND_USE_CMAKE_SYSTEM_PATH`
- to ``FALSE``::
+ to ``FALSE``:
- CMAKE_SYSTEM_PREFIX_PATH
- CMAKE_SYSTEM_FRAMEWORK_PATH
- CMAKE_SYSTEM_APPBUNDLE_PATH
+ * :variable:`CMAKE_SYSTEM_PREFIX_PATH`
+ * :variable:`CMAKE_SYSTEM_FRAMEWORK_PATH`
+ * :variable:`CMAKE_SYSTEM_APPBUNDLE_PATH`
+
+ The platform paths that these variables contain are locations that
+ typically include installed software. An example being ``/usr/local`` for
+ UNIX based platforms.
8. Search paths stored in the CMake :ref:`System Package Registry`.
This can be skipped if ``NO_CMAKE_SYSTEM_PACKAGE_REGISTRY`` is passed
diff --git a/Help/command/function.rst b/Help/command/function.rst
index 30938b3..7a9b907 100644
--- a/Help/command/function.rst
+++ b/Help/command/function.rst
@@ -44,14 +44,14 @@ can be invoked through any of
foo()
Foo()
FOO()
- cmake_command(INVOKE foo)
+ cmake_language(CALL foo)
and so on. However, it is strongly recommended to stay with the
case chosen in the function definition. Typically functions use
all-lowercase names.
-The :command:`cmake_command(INVOKE ...)` command can also be used to invoke the
-function.
+The :command:`cmake_language(CALL ...)` command can also be used to
+invoke the function.
Arguments
^^^^^^^^^
diff --git a/Help/command/get_property.rst b/Help/command/get_property.rst
index c0f9b46..80d97fd 100644
--- a/Help/command/get_property.rst
+++ b/Help/command/get_property.rst
@@ -10,6 +10,7 @@ Get a property.
DIRECTORY [<dir>] |
TARGET <target> |
SOURCE <source> |
+ [<TARGET_DIRECTORY ... | DIRECTORY ...>] |
INSTALL <file> |
TEST <test> |
CACHE <entry> |
@@ -49,6 +50,15 @@ It must be one of the following:
``VARIABLE``
Scope is unique and does not accept a name.
+In the ``SOURCE`` case, the queried source file scope can be changed by
+specifying one of the additional options: ``DIRECTORY`` or ``TARGET_DIRECTORY``.
+
+``DIRECTORY`` takes a path to a processed directory, and the source file property
+will be read from that directory scope.
+
+``TARGET_DIRECTORY`` takes the name of an existing target. The source file
+property will be read from this target's directory scope.
+
The required ``PROPERTY`` option is immediately followed by the name of
the property to get. If the property is not set an empty value is
returned, although some properties support inheriting from a parent scope
diff --git a/Help/command/get_source_file_property.rst b/Help/command/get_source_file_property.rst
index decec19..893a1b6 100644
--- a/Help/command/get_source_file_property.rst
+++ b/Help/command/get_source_file_property.rst
@@ -5,7 +5,7 @@ Get a property for a source file.
.. code-block:: cmake
- get_source_file_property(VAR file property)
+ get_source_file_property(VAR file [<TARGET_DIRECTORY ... | DIRECTORY ...>] property)
Gets a property from a source file. The value of the property is
stored in the variable ``VAR``. If the source property is not found, the
@@ -15,6 +15,15 @@ or not (see :command:`define_property`). Non-inherited properties will set
parent scope as described for the :command:`define_property` command and
if still unable to find the property, ``VAR`` will be set to an empty string.
+The queried source file scope can be changed by specifying one of the
+additional options: ``DIRECTORY`` or ``TARGET_DIRECTORY``.
+
+``DIRECTORY`` takes a path to a processed directory, and the source file property
+will be read from that directory scope.
+
+``TARGET_DIRECTORY`` takes the name of an existing target. The source file
+property will be read from this target's directory scope.
+
Use :command:`set_source_files_properties` to set property values. Source
file properties usually control how the file is built. One property that is
always there is :prop_sf:`LOCATION`.
diff --git a/Help/command/macro.rst b/Help/command/macro.rst
index 65159f4..797a90d 100644
--- a/Help/command/macro.rst
+++ b/Help/command/macro.rst
@@ -42,14 +42,14 @@ can be invoked through any of
foo()
Foo()
FOO()
- cmake_command(INVOKE foo)
+ cmake_language(CALL foo)
and so on. However, it is strongly recommended to stay with the
case chosen in the macro definition. Typically macros use
all-lowercase names.
-The :command:`cmake_command(INVOKE ...)` command can also be used to invoke the
-macro.
+The :command:`cmake_language(CALL ...)` command can also be used to
+invoke the macro.
Arguments
^^^^^^^^^
diff --git a/Help/command/option.rst b/Help/command/option.rst
index 8956307..02b8dac 100644
--- a/Help/command/option.rst
+++ b/Help/command/option.rst
@@ -9,7 +9,7 @@ Provide an option that the user can optionally select.
Provides an option for the user to select as ``ON`` or ``OFF``.
If no initial ``<value>`` is provided, ``OFF`` is used.
-If ``<variable>`` is already set as a normal variable
+If ``<variable>`` is already set as a normal or cache variable,
then the command does nothing (see policy :policy:`CMP0077`).
If you have options that depend on the values of other options, see
diff --git a/Help/command/set_property.rst b/Help/command/set_property.rst
index 1728c98..de28be3 100644
--- a/Help/command/set_property.rst
+++ b/Help/command/set_property.rst
@@ -8,7 +8,8 @@ Set a named property in a given scope.
set_property(<GLOBAL |
DIRECTORY [<dir>] |
TARGET [<target1> ...] |
- SOURCE [<src1> ...] |
+ SOURCE [<src1> ...]
+ [<TARGET_DIRECTORY ... | DIRECTORY ...>] |
INSTALL [<file1> ...] |
TEST [<test1> ...] |
CACHE [<entry1> ...] >
@@ -34,8 +35,16 @@ It must be one of the following:
``SOURCE``
Scope may name zero or more source files. Note that source
- file properties are visible only to targets added in the same
+ file properties are by default visible only to targets added in the same
directory (``CMakeLists.txt``).
+ The file properties can be made visible in a different directory by specifying
+ one of the additional options: ``TARGET_DIRECTORY`` or ``DIRECTORY``.
+
+ ``DIRECTORY`` takes a list of processed directories paths, and sets the file
+ properties in those directory scopes.
+
+ ``TARGET_DIRECTORY`` takes a list of existing targets. The file
+ properties will be set in these targets' directory scopes.
See also the :command:`set_source_files_properties` command.
``INSTALL``
diff --git a/Help/command/set_source_files_properties.rst b/Help/command/set_source_files_properties.rst
index ab95d70..8adfb9e 100644
--- a/Help/command/set_source_files_properties.rst
+++ b/Help/command/set_source_files_properties.rst
@@ -6,12 +6,25 @@ Source files can have properties that affect how they are built.
.. code-block:: cmake
set_source_files_properties([file1 [file2 [...]]]
+ [<TARGET_DIRECTORY ... | DIRECTORY ...>]
PROPERTIES prop1 value1
[prop2 value2 [...]])
Sets properties associated with source files using a key/value paired
list.
+Note that source file properties are by default visible only to
+targets added in the same directory (``CMakeLists.txt``).
+
+The file properties can be made visible in a different directory by specifying
+one of the additional options: ``TARGET_DIRECTORY`` or ``DIRECTORY``.
+
+``DIRECTORY`` takes a list of processed directories paths, and sets the file
+properties in those directory scopes.
+
+``TARGET_DIRECTORY`` takes a list of existing targets. The file
+properties will be set in these targets' directory scopes.
+
See also the :command:`set_property(SOURCE)` command.
See :ref:`Source File Properties` for the list of properties known
diff --git a/Help/command/source_group.rst b/Help/command/source_group.rst
index 6623c98..5ae9e51 100644
--- a/Help/command/source_group.rst
+++ b/Help/command/source_group.rst
@@ -37,11 +37,13 @@ explicitly lists the file with ``FILES`` will be favored, if any.
If no group explicitly lists the file, the *last* group whose
regular expression matches the file will be favored.
-The ``<name>`` of the group and ``<prefix>`` argument may contain backslashes
-to specify subgroups:
+The ``<name>`` of the group and ``<prefix>`` argument may contain forward
+slashes or backslashes to specify subgroups. Backslashes need to be escaped
+appropriately:
.. code-block:: cmake
+ source_group(base/subdir ...)
source_group(outer\\inner ...)
source_group(TREE <root> PREFIX sources\\inc ...)
diff --git a/Help/command/target_compile_options.rst b/Help/command/target_compile_options.rst
index 47e7d86..3c733c5 100644
--- a/Help/command/target_compile_options.rst
+++ b/Help/command/target_compile_options.rst
@@ -46,3 +46,5 @@ to use the more specific commands :command:`target_compile_definitions`
and :command:`target_include_directories`.
For directory-wide settings, there is the command :command:`add_compile_options`.
+
+For file-specific settings, there is the source file property :prop_sf:`COMPILE_OPTIONS`.
diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst
index edbf92c..323077a 100644
--- a/Help/command/try_compile.rst
+++ b/Help/command/try_compile.rst
@@ -135,6 +135,7 @@ If set, the following variables are passed in to the generated
try_compile CMakeLists.txt to initialize compile target properties with
default values:
+* :variable:`CMAKE_CUDA_RUNTIME_LIBRARY`
* :variable:`CMAKE_ENABLE_EXPORTS`
* :variable:`CMAKE_LINK_SEARCH_START_STATIC`
* :variable:`CMAKE_LINK_SEARCH_END_STATIC`
diff --git a/Help/dev/source.rst b/Help/dev/source.rst
index 65a6adf..0ccb8f4 100644
--- a/Help/dev/source.rst
+++ b/Help/dev/source.rst
@@ -163,6 +163,18 @@ It is allowed to pass raw pointers between objects to enable objects sharing.
A raw pointer **must** not be deleted. Only the object(s) owning the smart
pointer are allowed to delete dynamically allocated memory.
+Third Parties
+=============
+
+To build CMake, some third parties are needed. Under ``Utilities``
+directory, are versions of these third parties which can be used as an
+alternate to the ones provided by the system.
+
+To enable the selection of the third parties between the system and CMake ones,
+in CMake sources, third parties headers must be prefixed by ``cm3p/``
+(for example: ``<cm3p/json/reader.h>``). These wrappers are located under
+``Utilities/cm3p`` directory.
+
Source Tree Layout
==================
@@ -208,6 +220,9 @@ The CMake source tree is organized as follows.
* ``Utilities/std/cmext``:
Extensions to the C++ STL.
+ * ``Utilities/cm3p``:
+ Public headers for third parties needed to build CMake.
+
* ``Utilities/Sphinx/``:
Sphinx configuration to build CMake user documentation.
diff --git a/Help/envvar/ASM_DIALECTFLAGS.rst b/Help/envvar/ASM_DIALECTFLAGS.rst
index 3c3b02a..2e1c6d2 100644
--- a/Help/envvar/ASM_DIALECTFLAGS.rst
+++ b/Help/envvar/ASM_DIALECTFLAGS.rst
@@ -11,3 +11,5 @@ flags, after which the value for ``ASM<DIALECT>FLAGS`` is stored in the cache
as ``CMAKE_ASM<DIALECT>_FLAGS <CMAKE_<LANG>_FLAGS>``. For any configuration
run (including the first), the environment variable will be ignored, if the
``CMAKE_ASM<DIALECT>_FLAGS <CMAKE_<LANG>_FLAGS>`` variable is defined.
+
+See also :variable:`CMAKE_ASM<DIALECT>_FLAGS_INIT <CMAKE_<LANG>_FLAGS_INIT>`.
diff --git a/Help/envvar/CFLAGS.rst b/Help/envvar/CFLAGS.rst
index fda9ccc..190b4f4 100644
--- a/Help/envvar/CFLAGS.rst
+++ b/Help/envvar/CFLAGS.rst
@@ -9,3 +9,5 @@ flags, after which the value for ``CFLAGS`` is stored in the cache
as :variable:`CMAKE_C_FLAGS <CMAKE_<LANG>_FLAGS>`. For any configuration run
(including the first), the environment variable will be ignored if the
:variable:`CMAKE_C_FLAGS <CMAKE_<LANG>_FLAGS>` variable is defined.
+
+See also :variable:`CMAKE_C_FLAGS_INIT <CMAKE_<LANG>_FLAGS_INIT>`.
diff --git a/Help/envvar/CSFLAGS.rst b/Help/envvar/CSFLAGS.rst
index 404bb59..8762982 100644
--- a/Help/envvar/CSFLAGS.rst
+++ b/Help/envvar/CSFLAGS.rst
@@ -9,3 +9,5 @@ compilation flags, after which the value for ``CSFLAGS`` is stored in the cache
as :variable:`CMAKE_CSharp_FLAGS <CMAKE_<LANG>_FLAGS>`. For any configuration
run (including the first), the environment variable will be ignored if the
:variable:`CMAKE_CSharp_FLAGS <CMAKE_<LANG>_FLAGS>` variable is defined.
+
+See also :variable:`CMAKE_CSharp_FLAGS_INIT <CMAKE_<LANG>_FLAGS_INIT>`.
diff --git a/Help/envvar/CUDAFLAGS.rst b/Help/envvar/CUDAFLAGS.rst
index 4456d6b..14c5d84 100644
--- a/Help/envvar/CUDAFLAGS.rst
+++ b/Help/envvar/CUDAFLAGS.rst
@@ -9,3 +9,5 @@ compilation flags, after which the value for ``CUDAFLAGS`` is stored in the
cache as :variable:`CMAKE_CUDA_FLAGS <CMAKE_<LANG>_FLAGS>`. For any configuration
run (including the first), the environment variable will be ignored if
the :variable:`CMAKE_CUDA_FLAGS <CMAKE_<LANG>_FLAGS>` variable is defined.
+
+See also :variable:`CMAKE_CUDA_FLAGS_INIT <CMAKE_<LANG>_FLAGS_INIT>`.
diff --git a/Help/envvar/CXXFLAGS.rst b/Help/envvar/CXXFLAGS.rst
index d7296dc..460a347 100644
--- a/Help/envvar/CXXFLAGS.rst
+++ b/Help/envvar/CXXFLAGS.rst
@@ -9,3 +9,5 @@ compilation flags, after which the value for ``CXXFLAGS`` is stored in the cache
as :variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>`. For any configuration run (
including the first), the environment variable will be ignored if
the :variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>` variable is defined.
+
+See also :variable:`CMAKE_CXX_FLAGS_INIT <CMAKE_<LANG>_FLAGS_INIT>`.
diff --git a/Help/envvar/FFLAGS.rst b/Help/envvar/FFLAGS.rst
index 02d3c34..53bffb6 100644
--- a/Help/envvar/FFLAGS.rst
+++ b/Help/envvar/FFLAGS.rst
@@ -9,3 +9,5 @@ compilation flags, after which the value for ``FFLAGS`` is stored in the cache
as :variable:`CMAKE_Fortran_FLAGS <CMAKE_<LANG>_FLAGS>`. For any configuration
run (including the first), the environment variable will be ignored if
the :variable:`CMAKE_Fortran_FLAGS <CMAKE_<LANG>_FLAGS>` variable is defined.
+
+See also :variable:`CMAKE_Fortran_FLAGS_INIT <CMAKE_<LANG>_FLAGS_INIT>`.
diff --git a/Help/envvar/OBJC.rst b/Help/envvar/OBJC.rst
new file mode 100644
index 0000000..30c0d13
--- /dev/null
+++ b/Help/envvar/OBJC.rst
@@ -0,0 +1,14 @@
+OBJC
+----
+
+.. include:: ENV_VAR.txt
+
+Preferred executable for compiling ``OBJC`` language files. Will only be used
+by CMake on the first configuration to determine ``OBJC`` compiler, after
+which the value for ``OBJC`` is stored in the cache as
+:variable:`CMAKE_OBJC_COMPILER <CMAKE_<LANG>_COMPILER>`. For any configuration
+run (including the first), the environment variable will be ignored if the
+:variable:`CMAKE_OBJC_COMPILER <CMAKE_<LANG>_COMPILER>` variable is defined.
+
+If ``OBJC`` is not defined, the :envvar:`CC` environment variable will
+be checked instead.
diff --git a/Help/envvar/OBJCXX.rst b/Help/envvar/OBJCXX.rst
new file mode 100644
index 0000000..a72f7e7
--- /dev/null
+++ b/Help/envvar/OBJCXX.rst
@@ -0,0 +1,14 @@
+OBJCXX
+------
+
+.. include:: ENV_VAR.txt
+
+Preferred executable for compiling ``OBJCXX`` language files. Will only be used
+by CMake on the first configuration to determine ``OBJCXX`` compiler, after
+which the value for ``OBJCXX`` is stored in the cache as
+:variable:`CMAKE_OBJCXX_COMPILER <CMAKE_<LANG>_COMPILER>`. For any configuration
+run (including the first), the environment variable will be ignored if the
+:variable:`CMAKE_OBJCXX_COMPILER <CMAKE_<LANG>_COMPILER>` variable is defined.
+
+If ``OBJCXX`` is not defined, the :envvar:`CXX` environment variable will
+be checked instead.
diff --git a/Help/envvar/RCFLAGS.rst b/Help/envvar/RCFLAGS.rst
index 45419fe..bc43cb2 100644
--- a/Help/envvar/RCFLAGS.rst
+++ b/Help/envvar/RCFLAGS.rst
@@ -9,3 +9,5 @@ default compilation flags, after which the value for ``RCFLAGS`` is stored in
the cache as :variable:`CMAKE_RC_FLAGS <CMAKE_<LANG>_FLAGS>`. For any
configuration run (including the first), the environment variable will be ignored
if the :variable:`CMAKE_RC_FLAGS <CMAKE_<LANG>_FLAGS>` variable is defined.
+
+See also :variable:`CMAKE_RC_FLAGS_INIT <CMAKE_<LANG>_FLAGS_INIT>`.
diff --git a/Help/guide/user-interaction/index.rst b/Help/guide/user-interaction/index.rst
index 3a1038f..c724b6f 100644
--- a/Help/guide/user-interaction/index.rst
+++ b/Help/guide/user-interaction/index.rst
@@ -86,6 +86,7 @@ populated. It is always advised to use different
directories for the source and the build.
.. image:: /guide/user-interaction/GUI-Source-Binary.png
+ :alt: Choosing source and binary directories
Generating a Buildsystem
========================
@@ -246,16 +247,19 @@ The "Configure" button triggers a new dialog to
select the CMake generator to use.
.. image:: /guide/user-interaction/GUI-Configure-Dialog.png
+ :alt: Configuring a generator
All generators available on the command line are also
available in :manual:`cmake-gui(1)`.
.. image:: /guide/user-interaction/GUI-Choose-Generator.png
+ :alt: Choosing a generator
When choosing a Visual Studio generator, further options
are available to set an architecture to generate for.
.. image:: /manual/VS-Choose-Arch.png
+ :alt: Choosing an architecture for Visual Studio generators
.. _`Setting Build Variables`:
@@ -356,6 +360,7 @@ button. This triggers a new dialog to set the value of
the variable.
.. image:: /guide/user-interaction/GUI-Add-Entry.png
+ :alt: Editing a cache entry
The main view of the :manual:`cmake-gui(1)` user interface
can be used to edit existing variables.
diff --git a/Help/manual/cmake-commands.7.rst b/Help/manual/cmake-commands.7.rst
index 87743b4..0aa4f75 100644
--- a/Help/manual/cmake-commands.7.rst
+++ b/Help/manual/cmake-commands.7.rst
@@ -16,8 +16,8 @@ These commands are always available.
:maxdepth: 1
/command/break
- /command/cmake_command
/command/cmake_host_system_information
+ /command/cmake_language
/command/cmake_minimum_required
/command/cmake_parse_arguments
/command/cmake_policy
diff --git a/Help/manual/cmake-env-variables.7.rst b/Help/manual/cmake-env-variables.7.rst
index ee83799..ce1e360 100644
--- a/Help/manual/cmake-env-variables.7.rst
+++ b/Help/manual/cmake-env-variables.7.rst
@@ -63,6 +63,8 @@ Environment Variables for Languages
/envvar/CXXFLAGS
/envvar/FC
/envvar/FFLAGS
+ /envvar/OBJC
+ /envvar/OBJCXX
/envvar/RC
/envvar/RCFLAGS
/envvar/SWIFTC
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 9031e9c..a68170a 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -201,6 +201,7 @@ Properties on Targets
/prop_tgt/FOLDER
/prop_tgt/Fortran_FORMAT
/prop_tgt/Fortran_MODULE_DIRECTORY
+ /prop_tgt/Fortran_PREPROCESS
/prop_tgt/FRAMEWORK
/prop_tgt/FRAMEWORK_MULTI_CONFIG_POSTFIX_CONFIG
/prop_tgt/FRAMEWORK_VERSION
@@ -346,6 +347,7 @@ Properties on Targets
/prop_tgt/UNITY_BUILD_BATCH_SIZE
/prop_tgt/UNITY_BUILD_CODE_AFTER_INCLUDE
/prop_tgt/UNITY_BUILD_CODE_BEFORE_INCLUDE
+ /prop_tgt/UNITY_BUILD_MODE
/prop_tgt/VERSION
/prop_tgt/VISIBILITY_INLINES_HIDDEN
/prop_tgt/VS_CONFIGURATION_TYPE
@@ -465,6 +467,7 @@ Properties on Source Files
/prop_sf/COMPILE_OPTIONS
/prop_sf/EXTERNAL_OBJECT
/prop_sf/Fortran_FORMAT
+ /prop_sf/Fortran_PREPROCESS
/prop_sf/GENERATED
/prop_sf/HEADER_FILE_ONLY
/prop_sf/INCLUDE_DIRECTORIES
@@ -484,6 +487,7 @@ Properties on Source Files
/prop_sf/Swift_DEPENDENCIES_FILE
/prop_sf/Swift_DIAGNOSTICS_FILE
/prop_sf/SYMBOLIC
+ /prop_sf/UNITY_GROUP
/prop_sf/VS_COPY_TO_OUT_DIR
/prop_sf/VS_CSHARP_tagname
/prop_sf/VS_DEPLOYMENT_CONTENT
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 7d802e1..4ce8365 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -391,6 +391,7 @@ Variables that Control the Build
/variable/CMAKE_FRAMEWORK_MULTI_CONFIG_POSTFIX_CONFIG
/variable/CMAKE_Fortran_FORMAT
/variable/CMAKE_Fortran_MODULE_DIRECTORY
+ /variable/CMAKE_Fortran_PREPROCESS
/variable/CMAKE_GHS_NO_SOURCE_GROUP_FILE
/variable/CMAKE_GLOBAL_AUTOGEN_TARGET
/variable/CMAKE_GLOBAL_AUTOGEN_TARGET_NAME
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index e3e965c..9becfc6 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -481,13 +481,17 @@ Run a Script
.. code-block:: shell
- cmake [{-D <var>=<value>}...] -P <cmake-script-file>
+ cmake [{-D <var>=<value>}...] -P <cmake-script-file> [-- <unparsed-options>...]
Process the given cmake file as a script written in the CMake
language. No configure or generate step is performed and the cache
is not modified. If variables are defined using ``-D``, this must be
done before the ``-P`` argument.
+Any options after ``--`` are not parsed by CMake, but they are still included
+in the set of :variable:`CMAKE_ARGV<n> <CMAKE_ARGV0>` variables passed to the
+script (including the ``--`` itself).
+
Run a Command-Line Tool
=======================
diff --git a/Help/prop_sf/COMPILE_OPTIONS.rst b/Help/prop_sf/COMPILE_OPTIONS.rst
index 7e48271..537dcec 100644
--- a/Help/prop_sf/COMPILE_OPTIONS.rst
+++ b/Help/prop_sf/COMPILE_OPTIONS.rst
@@ -5,9 +5,7 @@ List of additional options to pass to the compiler.
This property holds a :ref:`semicolon-separated list <CMake Language Lists>` of options
and will be added to the list of compile flags when this
-source file builds. Use :prop_sf:`COMPILE_DEFINITIONS` to pass
-additional preprocessor definitions and :prop_sf:`INCLUDE_DIRECTORIES` to pass
-additional include directories.
+source file builds.
Contents of ``COMPILE_OPTIONS`` may use "generator expressions" with the
syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual
@@ -16,6 +14,19 @@ does not support per-config per-source settings, so expressions
that depend on the build configuration are not allowed with that
generator.
-.. note::
+Usage example:
- This property should be preferred over the :prop_sf:`COMPILE_FLAGS` property.
+.. code-block:: cmake
+
+ set_source_files_properties(foo.cpp PROPERTIES COMPILE_OPTIONS "-Wno-unused-parameter;-Wno-missing-field-initializer")
+
+Related properties:
+
+* Prefer this property over :prop_sf:`COMPILE_FLAGS`.
+* Use :prop_sf:`COMPILE_DEFINITIONS` to pass additional preprocessor definitions.
+* Use :prop_sf:`INCLUDE_DIRECTORIES` to pass additional include directories.
+
+Related commands:
+
+* :command:`add_compile_options` for directory-wide settings
+* :command:`target_compile_options` for target-specific settings
diff --git a/Help/prop_sf/Fortran_FORMAT.rst b/Help/prop_sf/Fortran_FORMAT.rst
index 1cbbf48..ef33926 100644
--- a/Help/prop_sf/Fortran_FORMAT.rst
+++ b/Help/prop_sf/Fortran_FORMAT.rst
@@ -4,7 +4,9 @@ Fortran_FORMAT
Set to ``FIXED`` or ``FREE`` to indicate the Fortran source layout.
This property tells CMake whether a given Fortran source file uses
-fixed-format or free-format. CMake will pass the corresponding format
-flag to the compiler. Consider using the target-wide
-:prop_tgt:`Fortran_FORMAT` property if all source files in a target
-share the same format.
+fixed-format or free-format. CMake will pass the corresponding format flag
+to the compiler. Consider using the target-wide :prop_tgt:`Fortran_FORMAT`
+property if all source files in a target share the same format.
+
+.. note:: For some compilers, ``NAG``, ``PGI`` and ``Solaris Studio``,
+ setting this to ``OFF`` will have no effect.
diff --git a/Help/prop_sf/Fortran_PREPROCESS.rst b/Help/prop_sf/Fortran_PREPROCESS.rst
new file mode 100644
index 0000000..25ea827
--- /dev/null
+++ b/Help/prop_sf/Fortran_PREPROCESS.rst
@@ -0,0 +1,17 @@
+Fortran_PREPROCESS
+------------------
+
+Control whether the Fortran source file should be unconditionally preprocessed.
+
+If unset or empty, rely on the compiler to determine whether the file
+should be preprocessed. If explicitly set to ``OFF`` then the file
+does not need to be preprocessed. If explicitly set to ``ON``, then
+the file does need to be preprocessed as part of the compilation step.
+
+When using the :generator:`Ninja` generator, all source files are
+first preprocessed in order to generate module dependency
+information. Setting this property to ``OFF`` will make ``Ninja``
+skip this step.
+
+Consider using the target-wide :prop_tgt:`Fortran_PREPROCESS` property
+if all source files in a target need to be preprocessed.
diff --git a/Help/prop_sf/OBJECT_OUTPUTS.rst b/Help/prop_sf/OBJECT_OUTPUTS.rst
index e7e880b..3e799ed 100644
--- a/Help/prop_sf/OBJECT_OUTPUTS.rst
+++ b/Help/prop_sf/OBJECT_OUTPUTS.rst
@@ -7,3 +7,6 @@ Additional outputs created by compilation of this source file. If any
of these outputs is missing the object will be recompiled. This is
supported only on the :generator:`Ninja` and :ref:`Makefile Generators`
and will be ignored on other generators.
+
+This property supports
+:manual:`generator expressions <cmake-generator-expressions(7)>`.
diff --git a/Help/prop_sf/UNITY_GROUP.rst b/Help/prop_sf/UNITY_GROUP.rst
new file mode 100644
index 0000000..ec6b0f6
--- /dev/null
+++ b/Help/prop_sf/UNITY_GROUP.rst
@@ -0,0 +1,5 @@
+UNITY_GROUP
+-----------
+
+This property controls which *bucket* the source will be part of when
+the :prop_tgt:`UNITY_BUILD_MODE` is set to ``GROUP``.
diff --git a/Help/prop_tgt/CUDA_RUNTIME_LIBRARY.rst b/Help/prop_tgt/CUDA_RUNTIME_LIBRARY.rst
index 0782765..11b344c 100644
--- a/Help/prop_tgt/CUDA_RUNTIME_LIBRARY.rst
+++ b/Help/prop_tgt/CUDA_RUNTIME_LIBRARY.rst
@@ -10,8 +10,8 @@ The allowed case insensitive values are:
Contents of ``CUDA_RUNTIME_LIBRARY`` may use
:manual:`generator expressions <cmake-generator-expressions(7)>`.
-If this property is not set then CMake uses the default value
-``Static`` to select the CUDA runtime library.
+If that property is not set then CMake uses an appropriate default
+value based on the compiler to select the CUDA runtime library.
.. note::
diff --git a/Help/prop_tgt/CUDA_STANDARD.rst b/Help/prop_tgt/CUDA_STANDARD.rst
index a3a2f56..6d6774e 100644
--- a/Help/prop_tgt/CUDA_STANDARD.rst
+++ b/Help/prop_tgt/CUDA_STANDARD.rst
@@ -7,7 +7,7 @@ This property specifies the CUDA/C++ standard whose features are requested
to build this target. For some compilers, this results in adding a
flag such as ``-std=gnu++11`` to the compile line.
-Supported values are ``98``, ``11``, ``14``.
+Supported values are ``98``, ``03``, ``11``, ``14``, ``17``, ``20``.
If the value requested does not result in a compile flag being added for
the compiler in use, a previous standard flag will be added instead. This
diff --git a/Help/prop_tgt/Fortran_PREPROCESS.rst b/Help/prop_tgt/Fortran_PREPROCESS.rst
new file mode 100644
index 0000000..47a15c0
--- /dev/null
+++ b/Help/prop_tgt/Fortran_PREPROCESS.rst
@@ -0,0 +1,23 @@
+Fortran_PREPROCESS
+------------------
+
+Control whether the Fortran source file should be unconditionally
+preprocessed.
+
+If unset or empty, rely on the compiler to determine whether the file
+should be preprocessed. If explicitly set to ``OFF`` then the file does not
+need to be preprocessed. If explicitly set to ``ON``, then the file does
+need to be preprocessed as part of the compilation step.
+
+When using the :generator:`Ninja` generator, all source files are
+first preprocessed in order to generate module dependency
+information. Setting this property to ``OFF`` will make ``Ninja``
+skip this step.
+
+Use the source-specific :prop_sf:`Fortran_PREPROCESS` property if a single
+file needs to be preprocessed. If the variable
+:variable:`CMAKE_Fortran_PREPROCESS` is set when a target is created its
+value is used to initialize this property.
+
+.. note:: For some compilers, ``NAG``, ``PGI`` and ``Solaris Studio``,
+ setting this to ``OFF`` will have no effect.
diff --git a/Help/prop_tgt/INSTALL_RPATH.rst b/Help/prop_tgt/INSTALL_RPATH.rst
index 93b4488..4549b92 100644
--- a/Help/prop_tgt/INSTALL_RPATH.rst
+++ b/Help/prop_tgt/INSTALL_RPATH.rst
@@ -8,5 +8,9 @@ targets (for platforms that support it). This property is initialized
by the value of the variable :variable:`CMAKE_INSTALL_RPATH` if it is set when
a target is created.
+Because the rpath may contain ``${ORIGIN}``, which coincides with CMake syntax,
+the contents of ``INSTALL_RPATH`` are properly escaped in the
+``cmake_install.cmake`` script (see policy :policy:`CMP0095`.)
+
This property supports
:manual:`generator expressions <cmake-generator-expressions(7)>`.
diff --git a/Help/prop_tgt/UNITY_BUILD.rst b/Help/prop_tgt/UNITY_BUILD.rst
index 479802e..e140952 100644
--- a/Help/prop_tgt/UNITY_BUILD.rst
+++ b/Help/prop_tgt/UNITY_BUILD.rst
@@ -5,8 +5,28 @@ When this property is set to true, the target source files will be combined
into batches for faster compilation. This is done by creating a (set of)
unity sources which ``#include`` the original sources, then compiling these
unity sources instead of the originals. This is known as a *Unity* or *Jumbo*
-build. The :prop_tgt:`UNITY_BUILD_BATCH_SIZE` property controls the upper
-limit on how many sources can be combined per unity source file.
+build.
+
+CMake provides different algorithms for selecting which sources are grouped
+together into a *bucket*. Algorithm selection is decided by the
+:prop_tgt:`UNITY_BUILD_MODE` target property, which has the following acceptable
+values:
+
+* ``BATCH``
+ When in this mode CMake determines which files are grouped together.
+ The :prop_tgt:`UNITY_BUILD_BATCH_SIZE` property controls the upper limit on
+ how many sources can be combined per unity source file.
+
+* ``GROUP``
+ When in this mode each target explicitly specifies how to group
+ source files. Each source file that has the same
+ :prop_sf:`UNITY_GROUP` value will be grouped together. Any sources
+ that don't have this property will be compiled individually. The
+ :prop_tgt:`UNITY_BUILD_BATCH_SIZE` property is ignored when using
+ this mode.
+
+If no explicit :prop_tgt:`UNITY_BUILD_MODE` has been specified, CMake will
+default to ``BATCH``.
Unity builds are not currently supported for all languages. CMake version
|release| supports combining ``C`` and ``CXX`` source files. For targets that
diff --git a/Help/prop_tgt/UNITY_BUILD_MODE.rst b/Help/prop_tgt/UNITY_BUILD_MODE.rst
new file mode 100644
index 0000000..1ebab23
--- /dev/null
+++ b/Help/prop_tgt/UNITY_BUILD_MODE.rst
@@ -0,0 +1,58 @@
+UNITY_BUILD_MODE
+----------------
+
+CMake provides different algorithms for selecting which sources are grouped
+together into a *bucket*. Selection is decided by this property,
+which has the following acceptable values:
+
+``BATCH``
+ When in this mode CMake determines which files are grouped together.
+ The :prop_tgt:`UNITY_BUILD_BATCH_SIZE` property controls the upper limit on
+ how many sources can be combined per unity source file.
+
+ Example usage:
+
+ .. code-block:: cmake
+
+ add_library(example_library
+ source1.cxx
+ source2.cxx
+ source3.cxx
+ source4.cxx)
+
+ set_target_properties(example_library PROPERTIES
+ UNITY_BUILD_MODE BATCH
+ UNITY_BUILD_BATCH_SIZE 2
+ )
+
+``GROUP``
+ When in this mode each target explicitly specifies how to group
+ source files. Each source file that has the same
+ :prop_sf:`UNITY_GROUP` value will be grouped together. Any sources
+ that don't have this property will be compiled individually. The
+ :prop_tgt:`UNITY_BUILD_BATCH_SIZE` property is ignored when using
+ this mode.
+
+ Example usage:
+
+ .. code-block:: cmake
+
+ add_library(example_library
+ source1.cxx
+ source2.cxx
+ source3.cxx
+ source4.cxx)
+
+ set_target_properties(example_library PROPERTIES
+ UNITY_BUILD_MODE GROUP
+ )
+
+ set_source_files_properties(source1.cxx source2.cxx source3.cxx
+ PROPERTIES UNITY_GROUP "bucket1"
+ )
+ set_source_files_properties(source4.cxx
+ PROPERTIES UNITY_GROUP "bucket2"
+ )
+
+If no explicit :prop_tgt:`UNITY_BUILD_MODE` has been specified, CMake will
+default to ``BATCH``.
diff --git a/Help/release/3.16.rst b/Help/release/3.16.rst
index e2d6788..f3fdb08 100644
--- a/Help/release/3.16.rst
+++ b/Help/release/3.16.rst
@@ -303,3 +303,16 @@ Changes made since CMake 3.16.0 include the following.
Additionally, the modules no longer expose their internal ``_Python*``
cache entries publicly. CMake 3.16.0 through 3.16.4 accidentally
made them visible as advanced cache entries.
+
+3.16.7
+------
+
+* Selection of the Objective C or C++ compiler now considers the
+ :envvar:`CC` or :envvar:`CXX` environment variable if the
+ :envvar:`OBJC` or :envvar:`OBJCXX` environment variable is not set.
+
+* The :module:`FindPkgConfig` module now extracts include directories
+ prefixed with ``-isystem`` into the ``*_INCLUDE_DIRS`` variables and
+ :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` target properties.
+ Previously they would be places in ``*_CFLAGS_OTHER`` variables and
+ :prop_tgt:`INTERFACE_COMPILE_OPTIONS` target properties.
diff --git a/Help/release/3.17.rst b/Help/release/3.17.rst
index 7c5b44d..b7c66d8 100644
--- a/Help/release/3.17.rst
+++ b/Help/release/3.17.rst
@@ -333,3 +333,16 @@ Changes made since CMake 3.17.0 include the following.
* CMake 3.17.0 updated the :cpack_gen:`CPack NSIS Generator` with changes
that require NSIS 3.0 or later. CMake 3.17.1 now enforces the use
of a sufficiently new version.
+
+3.17.3
+------
+
+* Selection of the Objective C or C++ compiler now considers the
+ :envvar:`CC` or :envvar:`CXX` environment variable if the
+ :envvar:`OBJC` or :envvar:`OBJCXX` environment variable is not set.
+
+* The :module:`FindPkgConfig` module now extracts include directories
+ prefixed with ``-isystem`` into the ``*_INCLUDE_DIRS`` variables and
+ :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` target properties.
+ Previously they would be places in ``*_CFLAGS_OTHER`` variables and
+ :prop_tgt:`INTERFACE_COMPILE_OPTIONS` target properties.
diff --git a/Help/release/dev/FindPython-IronPython-support.rst b/Help/release/dev/FindPython-IronPython-support.rst
new file mode 100644
index 0000000..0ed11e9
--- /dev/null
+++ b/Help/release/dev/FindPython-IronPython-support.rst
@@ -0,0 +1,5 @@
+FindPython-IronPython-support
+-----------------------------
+
+* The :module:`FindPython3`, :module:`FindPython2` and :module:`FindPython`
+ modules support now the ``IronPython`` implementation on all platforms.
diff --git a/Help/release/dev/FindPython-pypy.rst b/Help/release/dev/FindPython-pypy.rst
new file mode 100644
index 0000000..84f0db1
--- /dev/null
+++ b/Help/release/dev/FindPython-pypy.rst
@@ -0,0 +1,5 @@
+FindPython-pypy
+---------------
+
+* The :module:`FindPython3`, :module:`FindPython2` and :module:`FindPython`
+ modules gained the capability to handle ``PyPy`` product.
diff --git a/Help/release/dev/cmake_command-command.rst b/Help/release/dev/cmake_command-command.rst
deleted file mode 100644
index 6200ae2..0000000
--- a/Help/release/dev/cmake_command-command.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-cmake_command
--------------
-
-* The :command:`cmake_command()` command was added for meta-operations on
- scripted or built-in commands, starting with a mode to ``INVOKE`` other
- commands, and ``EVAL CODE`` to inplace evaluate a CMake script.
diff --git a/Help/release/dev/cmake_language-command.rst b/Help/release/dev/cmake_language-command.rst
new file mode 100644
index 0000000..5c00cea
--- /dev/null
+++ b/Help/release/dev/cmake_language-command.rst
@@ -0,0 +1,6 @@
+cmake_language-command
+----------------------
+
+* The :command:`cmake_language()` command was added for meta-operations on
+ scripted or built-in commands, starting with a mode to ``CALL`` other
+ commands, and ``EVAL CODE`` to inplace evaluate a CMake script.
diff --git a/Help/release/dev/ctest-log-environment.rst b/Help/release/dev/ctest-log-environment.rst
new file mode 100644
index 0000000..0636a25
--- /dev/null
+++ b/Help/release/dev/ctest-log-environment.rst
@@ -0,0 +1,8 @@
+ctest-log-environment
+---------------------
+
+* :manual:`ctest(1)` now logs environment variables that it sets for each test,
+ either due to the :prop_test:`ENVIRONMENT` property or the
+ :ref:`resource allocation <ctest-resource-allocation>` feature, and submits
+ this log to CDash. It does not log environment variables that were set
+ outside of CTest.
diff --git a/Help/release/dev/cuda-clang.rst b/Help/release/dev/cuda-clang.rst
new file mode 100644
index 0000000..fa5cd5a
--- /dev/null
+++ b/Help/release/dev/cuda-clang.rst
@@ -0,0 +1,4 @@
+cuda-clang
+----------
+
+* The ``CUDA`` language now supports Clang as a compiler.
diff --git a/Help/release/dev/fetchcontent-SOURCE_SUBDIR.rst b/Help/release/dev/fetchcontent-SOURCE_SUBDIR.rst
new file mode 100644
index 0000000..e9e185c
--- /dev/null
+++ b/Help/release/dev/fetchcontent-SOURCE_SUBDIR.rst
@@ -0,0 +1,6 @@
+fetchcontent-SOURCE_SUBDIR
+--------------------------
+
+* The :command:`FetchContent_Declare` command now supports a ``SOURCE_SUBDIR``
+ option. It can be used to direct :command:`FetchContent_MakeAvailable`
+ to look in a different location for the ``CMakeLists.txt`` file.
diff --git a/Help/release/dev/fortran-preprocess-property.rst b/Help/release/dev/fortran-preprocess-property.rst
new file mode 100644
index 0000000..d18e7b8
--- /dev/null
+++ b/Help/release/dev/fortran-preprocess-property.rst
@@ -0,0 +1,6 @@
+fortran-preprocess-property
+---------------------------
+
+* The :prop_tgt:`Fortran_PREPROCESS` target property and
+ :prop_sf:`Fortran_PREPROCESS` source-file property were added to
+ control preprocessing of Fortran source files.
diff --git a/Help/release/dev/genex-OBJECT_OUTPUTS.rst b/Help/release/dev/genex-OBJECT_OUTPUTS.rst
new file mode 100644
index 0000000..738dcbb
--- /dev/null
+++ b/Help/release/dev/genex-OBJECT_OUTPUTS.rst
@@ -0,0 +1,4 @@
+genex-OBJECT_OUTPUTS
+--------------------
+
+* :prop_sf:`OBJECT_OUTPUTS` now support :manual:`generator expressions <cmake-generator-expressions(7)>`.
diff --git a/Help/release/dev/grouped-unity-build-mode.rst b/Help/release/dev/grouped-unity-build-mode.rst
new file mode 100644
index 0000000..802de4a
--- /dev/null
+++ b/Help/release/dev/grouped-unity-build-mode.rst
@@ -0,0 +1,6 @@
+grouped-unity-build-mode
+------------------------
+
+* The :prop_tgt:`UNITY_BUILD_MODE` target property was added to tell
+ generators which algorithm to use for grouping included source
+ files.
diff --git a/Help/release/dev/sf-property-scopes.rst b/Help/release/dev/sf-property-scopes.rst
new file mode 100644
index 0000000..0b61625
--- /dev/null
+++ b/Help/release/dev/sf-property-scopes.rst
@@ -0,0 +1,15 @@
+sf-property-scopes
+------------------
+
+* The :command:`set_property` with the ``SOURCE`` scope gained the
+ ``DIRECTORY`` and ``TARGET_DIRECTORY`` options to set properties
+ in the provided directory scopes.
+* The :command:`set_source_files_properties` gained the ``DIRECTORY``
+ and ``TARGET_DIRECTORY`` options to set properties in the provided
+ directory scopes.
+* The :command:`get_property` with ``SOURCE`` scope gained the
+ ``DIRECTORY`` and ``TARGET_DIRECTORY`` options to get a property
+ from the provided directory scope.
+* The :command:`get_source_file_property` gained the ``DIRECTORY``
+ and ``TARGET_DIRECTORY`` options to get a property from the
+ provided directory scope.
diff --git a/Help/release/dev/source_group_forward_slashes.rst b/Help/release/dev/source_group_forward_slashes.rst
new file mode 100644
index 0000000..fa0dfa9
--- /dev/null
+++ b/Help/release/dev/source_group_forward_slashes.rst
@@ -0,0 +1,5 @@
+source_group_forward_slashes
+----------------------------
+
+* The :command:`source_group` command now also recognizes forward slashes
+ as subgroup delimiters, not just backslashes.
diff --git a/Help/variable/CMAKE_CUDA_RUNTIME_LIBRARY.rst b/Help/variable/CMAKE_CUDA_RUNTIME_LIBRARY.rst
index ea1c1b8..e3205d3 100644
--- a/Help/variable/CMAKE_CUDA_RUNTIME_LIBRARY.rst
+++ b/Help/variable/CMAKE_CUDA_RUNTIME_LIBRARY.rst
@@ -1,7 +1,7 @@
CMAKE_CUDA_RUNTIME_LIBRARY
--------------------------
-Select the CUDA runtime library for use by compilers targeting the MSVC ABI.
+Select the CUDA runtime library for use when compiling and linking CUDA.
This variable is used to initialize the :prop_tgt:`CUDA_RUNTIME_LIBRARY`
property on all targets as they are created.
@@ -14,7 +14,8 @@ Contents of ``CMAKE_CUDA_RUNTIME_LIBRARY`` may use
If this variable is not set then the :prop_tgt:`CUDA_RUNTIME_LIBRARY` target
property will not be set automatically. If that property is not set then
-CMake uses the default value ``Static`` to select the CUDA runtime library.
+CMake uses an appropriate default value based on the compiler to select the
+CUDA runtime library.
.. note::
diff --git a/Help/variable/CMAKE_Fortran_PREPROCESS.rst b/Help/variable/CMAKE_Fortran_PREPROCESS.rst
new file mode 100644
index 0000000..74b2d8b
--- /dev/null
+++ b/Help/variable/CMAKE_Fortran_PREPROCESS.rst
@@ -0,0 +1,8 @@
+CMAKE_Fortran_PREPROCESS
+------------------------
+
+Default value for :prop_tgt:`Fortran_PREPROCESS` of targets.
+
+This variable is used to initialize the :prop_tgt:`Fortran_PREPROCESS`
+property on all the targets. See that target property for additional
+information.
diff --git a/Help/variable/CMAKE_LANG_FLAGS_INIT.rst b/Help/variable/CMAKE_LANG_FLAGS_INIT.rst
index a88d122..4a034e8 100644
--- a/Help/variable/CMAKE_LANG_FLAGS_INIT.rst
+++ b/Help/variable/CMAKE_LANG_FLAGS_INIT.rst
@@ -5,7 +5,11 @@ Value used to initialize the :variable:`CMAKE_<LANG>_FLAGS` cache entry
the first time a build tree is configured for language ``<LANG>``.
This variable is meant to be set by a :variable:`toolchain file
<CMAKE_TOOLCHAIN_FILE>`. CMake may prepend or append content to
-the value based on the environment and target platform.
+the value based on the environment and target platform. For example,
+the contents of a ``xxxFLAGS`` environment variable will be prepended,
+where ``xxx`` will be language-specific but not necessarily the same as
+``<LANG>`` (e.g. :envvar:`CXXFLAGS` for ``CXX``, :envvar:`FFLAGS` for
+``Fortran``, and so on).
See also the configuration-specific
:variable:`CMAKE_<LANG>_FLAGS_<CONFIG>_INIT` variable.
diff --git a/Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst b/Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst
index 87a9d06..81a7a0b 100644
--- a/Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst
+++ b/Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst
@@ -8,11 +8,43 @@ CMAKE_SYSTEM_PREFIX_PATH
subdirectories (like ``bin``, ``lib``, or ``include``) as specified in its own
documentation.
-By default this contains the standard directories for the current system, the
+By default this contains the system directories for the current system, the
:variable:`CMAKE_INSTALL_PREFIX`, and the :variable:`CMAKE_STAGING_PREFIX`.
The installation and staging prefixes may be excluded by setting
the :variable:`CMAKE_FIND_NO_INSTALL_PREFIX` variable.
+The system directories that are contained in ``CMAKE_SYSTEM_PREFIX_PATH`` are
+locations that typically include installed software. An example being
+``/usr/local`` for UNIX based platforms. In addition to standard platform
+locations, CMake will also add values to ``CMAKE_SYSTEM_PREFIX_PATH`` based on
+environment variables. The environment variables and search locations that
+CMake uses may evolve over time, as platforms and their conventions also
+evolve. The following provides an indicative list of environment variables
+and locations that CMake searches, but they are subject to change:
+
+
+CrayLinuxEnvironment:
+ * ``ENV{SYSROOT_DIR}/``
+ * ``ENV{SYSROOT_DIR}/usr``
+ * ``ENV{SYSROOT_DIR}/usr/local``
+
+Darwin:
+ * ``ENV{SDKROOT}/usr`` When ``CMAKE_OSX_SYSROOT`` is not explicitly specified.
+
+OpenBSD:
+ * ``ENV{LOCALBASE}``
+
+Unix:
+ * ``ENV{CONDA_PREFIX}`` when using a conda compiler
+
+Windows:
+ * ``ENV{ProgramW6432}``
+ * ``ENV{ProgramFiles}``
+ * ``ENV{ProgramFiles(x86)}``
+ * ``ENV{SystemDrive}/Program Files``
+ * ``ENV{SystemDrive}/Program Files (x86)``
+
+
``CMAKE_SYSTEM_PREFIX_PATH`` is *not* intended to be modified by the project;
use :variable:`CMAKE_PREFIX_PATH` for this.
diff --git a/Modules/CMakeCUDACompiler.cmake.in b/Modules/CMakeCUDACompiler.cmake.in
index 289e96e..64fb469 100644
--- a/Modules/CMakeCUDACompiler.cmake.in
+++ b/Modules/CMakeCUDACompiler.cmake.in
@@ -54,6 +54,8 @@ 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@")
+@_SET_CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT@
+
set(CMAKE_LINKER "@CMAKE_LINKER@")
set(CMAKE_AR "@CMAKE_AR@")
set(CMAKE_MT "@CMAKE_MT@")
diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake
index e8b60b6..f9f7574 100644
--- a/Modules/CMakeCUDAInformation.cmake
+++ b/Modules/CMakeCUDAInformation.cmake
@@ -8,6 +8,19 @@ else()
endif()
set(CMAKE_INCLUDE_FLAG_CUDA "-I")
+# Set implicit links early so compiler-specific modules can use them.
+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()
+
# Load compiler-specific information.
if(CMAKE_CUDA_COMPILER_ID)
include(Compiler/${CMAKE_CUDA_COMPILER_ID}-CUDA OPTIONAL)
@@ -97,22 +110,10 @@ include(CMakeCommonLanguageInclude)
# CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION
# CMAKE_CUDA_LINK_EXECUTABLE
-if(CMAKE_CUDA_HOST_COMPILER)
+if(CMAKE_CUDA_HOST_COMPILER AND CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
string(APPEND _CMAKE_CUDA_EXTRA_FLAGS " -ccbin=<CMAKE_CUDA_HOST_COMPILER>")
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
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
index bb573b7..acd15df 100644
--- a/Modules/CMakeCompilerIdDetection.cmake
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -89,9 +89,8 @@ function(compiler_id_detection outvar lang)
)
endif()
- #Currently the only CUDA compilers are NVIDIA
if(lang STREQUAL CUDA)
- set(ordered_compilers NVIDIA)
+ set(ordered_compilers NVIDIA Clang)
endif()
if(CID_ID_DEFINE)
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
index ead4125..4a8a268 100644
--- a/Modules/CMakeDetermineCUDACompiler.cmake
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -2,7 +2,7 @@
# file Copyright.txt or https://cmake.org/licensing for details.
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
-include(${CMAKE_ROOT}/Modules//CMakeParseImplicitLinkInfo.cmake)
+include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake)
if( NOT ( ("${CMAKE_GENERATOR}" MATCHES "Make") OR
("${CMAKE_GENERATOR}" MATCHES "Ninja") OR
@@ -57,16 +57,39 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
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")
+ list(APPEND CMAKE_CUDA_COMPILER_ID_VENDORS NVIDIA Clang)
+ set(CMAKE_CUDA_COMPILER_ID_VENDOR_REGEX_NVIDIA "nvcc: NVIDIA \\(R\\) Cuda compiler driver")
+ set(CMAKE_CUDA_COMPILER_ID_VENDOR_REGEX_Clang "(clang version)")
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")
- set(CMAKE_CUDA_COMPILER_ID_FLAGS_ALWAYS -v --keep --keep-dir tmp)
+ # nvcc
+ set(nvcc_test_flags "--keep --keep-dir tmp")
if(CMAKE_CUDA_HOST_COMPILER)
- list(APPEND CMAKE_CUDA_COMPILER_ID_FLAGS_ALWAYS "-ccbin=${CMAKE_CUDA_HOST_COMPILER}")
+ string(APPEND nvcc_test_flags " -ccbin=${CMAKE_CUDA_HOST_COMPILER}")
endif()
+ list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST ${nvcc_test_flags})
+
+ # Clang
+ if(CMAKE_CROSSCOMPILING)
+ # Need to pass the host target and include directories if we're crosscompiling.
+ set(clang_test_flags "--sysroot=\"${CMAKE_SYSROOT}\" --target=${CMAKE_CUDA_COMPILER_TARGET}")
+ else()
+ set(clang_test_flags)
+ endif()
+
+ # Clang doesn't automatically select an architecture supported by the SDK.
+ # Try in reverse order of deprecation with the most recent at front (i.e. the most likely to work for new setups).
+ foreach(arch ${CMAKE_CUDA_ARCHITECTURES} "20" "30" "52")
+ # Strip specifiers.
+ string(REGEX MATCH "[0-9]+" arch_name "${arch}")
+ list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${clang_test_flags} --cuda-gpu-arch=sm_${arch_name}")
+ endforeach()
+
+ # Finally also try the default.
+ list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${clang_test_flags}")
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
CMAKE_DETERMINE_COMPILER_ID(CUDA CUDAFLAGS CMakeCUDACompilerId.cu)
@@ -89,6 +112,39 @@ if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "")
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES "")
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
+
+ # We do not currently detect CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES but we
+ # do need to detect CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT from the compiler by
+ # looking at which cudart library exists in the implicit link libraries passed
+ # to the host linker.
+ if(CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT MATCHES "link\\.exe [^\n]*cudart_static\\.lib")
+ set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "STATIC")
+ elseif(CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT MATCHES "link\\.exe [^\n]*cudart\\.lib")
+ set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "SHARED")
+ else()
+ set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "NONE")
+ endif()
+ set(_SET_CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT
+ "set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT \"${CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT}\")")
+elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
+ # Parse default CUDA architecture.
+ if(NOT CMAKE_CUDA_ARCHITECTURES)
+ string(REGEX MATCH "-target-cpu sm_([0-9]+)" dont_care "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
+ set(CMAKE_CUDA_ARCHITECTURES "${CMAKE_MATCH_1}" CACHE STRING "CUDA architectures")
+
+ if(NOT CMAKE_CUDA_ARCHITECTURES)
+ message(FATAL_ERROR "Failed to find default CUDA architecture.")
+ endif()
+ endif()
+
+ # Clang does not add any CUDA SDK libraries or directories when invoking the host linker.
+ # Add the CUDA toolkit library directory ourselves so that linking works.
+ # The CUDA runtime libraries are handled elsewhere by CMAKE_CUDA_RUNTIME_LIBRARY.
+ include(Internal/CUDAToolkit)
+ set(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES "${CUDAToolkit_INCLUDE_DIR}")
+ set(CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES "${CUDAToolkit_LIBRARY_DIR}")
+ set(CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "")
+ set(CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
set(_nvcc_log "")
string(REPLACE "\r" "" _nvcc_output_orig "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
@@ -182,6 +238,20 @@ elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
log
"${CMAKE_CUDA_IMPLICIT_OBJECT_REGEX}")
+ # Detect CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT from the compiler by looking at which
+ # cudart library exists in the implicit link libraries passed to the host linker.
+ # This is required when a project sets the cuda runtime library as part of the
+ # initial flags.
+ if(";${CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES};" MATCHES [[;cudart_static(\.lib)?;]])
+ set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "STATIC")
+ elseif(";${CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES};" MATCHES [[;cudart(\.lib)?;]])
+ set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "SHARED")
+ else()
+ set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "NONE")
+ endif()
+ set(_SET_CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT
+ "set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT \"${CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT}\")")
+
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()
@@ -191,6 +261,24 @@ elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
endif()
endif()
+# CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES is detected above as the list of
+# libraries that the CUDA compiler implicitly passes to the host linker.
+# CMake invokes the host linker directly and so needs to pass these libraries.
+# We filter out those that should not be passed unconditionally both here
+# and from CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES in CMakeTestCUDACompiler.
+set(CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES_EXCLUDE
+ # The CUDA runtime libraries are controlled by CMAKE_CUDA_RUNTIME_LIBRARY.
+ cudart cudart.lib
+ cudart_static cudart_static.lib
+ cudadevrt cudadevrt.lib
+
+ # Dependencies of the CUDA static runtime library on Linux hosts.
+ rt
+ pthread
+ dl
+ )
+list(REMOVE_ITEM CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES ${CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES_EXCLUDE})
+
if(CMAKE_CUDA_COMPILER_SYSROOT)
string(CONCAT _SET_CMAKE_CUDA_COMPILER_SYSROOT
"set(CMAKE_CUDA_COMPILER_SYSROOT \"${CMAKE_CUDA_COMPILER_SYSROOT}\")\n"
diff --git a/Modules/CMakeDetermineCompiler.cmake b/Modules/CMakeDetermineCompiler.cmake
index da93b5c..7cd7c47 100644
--- a/Modules/CMakeDetermineCompiler.cmake
+++ b/Modules/CMakeDetermineCompiler.cmake
@@ -141,7 +141,8 @@ function(_cmake_find_compiler_sysroot lang)
ERROR_VARIABLE _cmake_sysroot_run_err)
if(_cmake_sysroot_run_out AND NOT _cmake_sysroot_run_err AND IS_DIRECTORY "${_cmake_sysroot_run_out}/usr")
- set(CMAKE_${lang}_COMPILER_SYSROOT "${_cmake_sysroot_run_out}/usr" PARENT_SCOPE)
+ file(TO_CMAKE_PATH "${_cmake_sysroot_run_out}/usr" _cmake_sysroot_run_out_usr)
+ set(CMAKE_${lang}_COMPILER_SYSROOT "${_cmake_sysroot_run_out_usr}" PARENT_SCOPE)
else()
set(CMAKE_${lang}_COMPILER_SYSROOT "" PARENT_SCOPE)
endif()
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 9ebaa6c..df48fa5 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -381,7 +381,11 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
if(CMAKE_VS_PLATFORM_NAME STREQUAL x64)
set(id_ItemDefinitionGroup_entry "<CudaCompile><TargetMachinePlatform>64</TargetMachinePlatform><AdditionalOptions>%(AdditionalOptions)-v</AdditionalOptions></CudaCompile>")
endif()
- set(id_Link_AdditionalDependencies "<AdditionalDependencies>cudart.lib</AdditionalDependencies>")
+ if(CMAKE_CUDA_FLAGS MATCHES "(^| )-cudart +shared( |$)")
+ set(id_Link_AdditionalDependencies "<AdditionalDependencies>cudart.lib</AdditionalDependencies>")
+ else()
+ set(id_Link_AdditionalDependencies "<AdditionalDependencies>cudart_static.lib</AdditionalDependencies>")
+ endif()
endif()
configure_file(${CMAKE_ROOT}/Modules/CompilerId/VS-${v}.${ext}.in
${id_dir}/CompilerId${lang}.${ext} @ONLY)
diff --git a/Modules/CMakeDetermineOBJCCompiler.cmake b/Modules/CMakeDetermineOBJCCompiler.cmake
index ad13eab..11b47fd 100644
--- a/Modules/CMakeDetermineOBJCCompiler.cmake
+++ b/Modules/CMakeDetermineOBJCCompiler.cmake
@@ -34,16 +34,19 @@ else()
if(NOT CMAKE_OBJC_COMPILER)
set(CMAKE_OBJC_COMPILER_INIT NOTFOUND)
- # prefer the environment variable OBJC
- if($ENV{OBJC} MATCHES ".+")
- get_filename_component(CMAKE_OBJC_COMPILER_INIT $ENV{OBJC} PROGRAM PROGRAM_ARGS CMAKE_OBJC_FLAGS_ENV_INIT)
- if(CMAKE_OBJC_FLAGS_ENV_INIT)
- set(CMAKE_OBJC_COMPILER_ARG1 "${CMAKE_OBJC_FLAGS_ENV_INIT}" CACHE STRING "First argument to Objective-C compiler")
+ # prefer the environment variable OBJC or CC
+ foreach(var OBJC CC)
+ if($ENV{${var}} MATCHES ".+")
+ get_filename_component(CMAKE_OBJC_COMPILER_INIT $ENV{${var}} PROGRAM PROGRAM_ARGS CMAKE_OBJC_FLAGS_ENV_INIT)
+ if(CMAKE_OBJC_FLAGS_ENV_INIT)
+ set(CMAKE_OBJC_COMPILER_ARG1 "${CMAKE_OBJC_FLAGS_ENV_INIT}" CACHE STRING "First argument to Objective-C compiler")
+ endif()
+ if(NOT EXISTS ${CMAKE_OBJC_COMPILER_INIT})
+ message(FATAL_ERROR "Could not find compiler set in environment variable ${var}:\n $ENV{${var}}")
+ endif()
+ break()
endif()
- if(NOT EXISTS ${CMAKE_OBJC_COMPILER_INIT})
- message(FATAL_ERROR "Could not find compiler set in environment variable OBJC:\n$ENV{OBJC}.")
- endif()
- endif()
+ endforeach()
# next try prefer the compiler specified by the generator
if(CMAKE_GENERATOR_OBJC)
diff --git a/Modules/CMakeDetermineOBJCXXCompiler.cmake b/Modules/CMakeDetermineOBJCXXCompiler.cmake
index 2cf5119..99ad6c3 100644
--- a/Modules/CMakeDetermineOBJCXXCompiler.cmake
+++ b/Modules/CMakeDetermineOBJCXXCompiler.cmake
@@ -36,16 +36,19 @@ else()
if(NOT CMAKE_OBJCXX_COMPILER)
set(CMAKE_OBJCXX_COMPILER_INIT NOTFOUND)
- # prefer the environment variable OBJCXX
- if($ENV{OBJCXX} MATCHES ".+")
- get_filename_component(CMAKE_OBJCXX_COMPILER_INIT $ENV{OBJCXX} PROGRAM PROGRAM_ARGS CMAKE_OBJCXX_FLAGS_ENV_INIT)
- if(CMAKE_OBJCXX_FLAGS_ENV_INIT)
- set(CMAKE_OBJCXX_COMPILER_ARG1 "${CMAKE_OBJCXX_FLAGS_ENV_INIT}" CACHE STRING "First argument to Objective-C++ compiler")
+ # prefer the environment variable OBJCXX or CXX
+ foreach(var OBJCXX CXX)
+ if($ENV{${var}} MATCHES ".+")
+ get_filename_component(CMAKE_OBJCXX_COMPILER_INIT $ENV{${var}} PROGRAM PROGRAM_ARGS CMAKE_OBJCXX_FLAGS_ENV_INIT)
+ if(CMAKE_OBJCXX_FLAGS_ENV_INIT)
+ set(CMAKE_OBJCXX_COMPILER_ARG1 "${CMAKE_OBJCXX_FLAGS_ENV_INIT}" CACHE STRING "First argument to Objective-C++ compiler")
+ endif()
+ if(NOT EXISTS ${CMAKE_OBJCXX_COMPILER_INIT})
+ message(FATAL_ERROR "Could not find compiler set in environment variable ${var}:\n $ENV{${var}}")
+ endif()
+ break()
endif()
- if(NOT EXISTS ${CMAKE_OBJCXX_COMPILER_INIT})
- message(FATAL_ERROR "Could not find compiler set in environment variable OBJCXX:\n$ENV{OBJCXX}.\n${CMAKE_OBJCXX_COMPILER_INIT}")
- endif()
- endif()
+ endforeach()
# next prefer the generator specified compiler
if(CMAKE_GENERATOR_OBJCXX)
diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake
index f539b46..000fba1 100644
--- a/Modules/CMakeGenericSystem.cmake
+++ b/Modules/CMakeGenericSystem.cmake
@@ -50,15 +50,9 @@ if(CMAKE_GENERATOR MATCHES "Make")
if(DEFINED CMAKE_TARGET_MESSAGES)
set_property(GLOBAL PROPERTY TARGET_MESSAGES ${CMAKE_TARGET_MESSAGES})
endif()
- if(CMAKE_GENERATOR MATCHES "Unix Makefiles")
- set(CMAKE_EXPORT_COMPILE_COMMANDS "$ENV{CMAKE_EXPORT_COMPILE_COMMANDS}"
- CACHE BOOL "Enable/Disable output of compile commands during generation."
- )
- mark_as_advanced(CMAKE_EXPORT_COMPILE_COMMANDS)
- endif()
endif()
-if(CMAKE_GENERATOR MATCHES "Ninja")
+if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS AND CMAKE_GENERATOR MATCHES "Ninja|Unix Makefiles")
set(CMAKE_EXPORT_COMPILE_COMMANDS "$ENV{CMAKE_EXPORT_COMPILE_COMMANDS}"
CACHE BOOL "Enable/Disable output of compile commands during generation."
)
diff --git a/Modules/CMakeTestCUDACompiler.cmake b/Modules/CMakeTestCUDACompiler.cmake
index 05811a8..6d39d3e 100644
--- a/Modules/CMakeTestCUDACompiler.cmake
+++ b/Modules/CMakeTestCUDACompiler.cmake
@@ -67,27 +67,22 @@ else()
set(CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES "${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES}")
endif()
- # Remove the following libraries from CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES and
- # CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES
- #
- # - cudart
- # - cudart_static
- # - cudadevrt
- #
- # These are controlled by CMAKE_CUDA_RUNTIME_LIBRARY
- list(REMOVE_ITEM CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES cudart cudart_static cudadevrt)
- list(REMOVE_ITEM CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES cudart cudart_static cudadevrt)
+ # Filter out implicit link libraries that should not be passed unconditionally.
+ # See CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES_EXCLUDE in CMakeDetermineCUDACompiler.
+ list(REMOVE_ITEM CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES ${CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES_EXCLUDE})
- # Remove the CUDA Toolkit include directories from the set of
- # implicit system include directories.
- # This resolves the issue that NVCC doesn't specify these
- # includes as SYSTEM includes when compiling device code, and sometimes
- # they contain headers that generate warnings, so let users mark them
- # as SYSTEM explicitly
- if(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES)
- list(REMOVE_ITEM CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES
- ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}
- )
+ if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
+ # Remove the CUDA Toolkit include directories from the set of
+ # implicit system include directories.
+ # This resolves the issue that NVCC doesn't specify these
+ # includes as SYSTEM includes when compiling device code, and sometimes
+ # they contain headers that generate warnings, so let users mark them
+ # as SYSTEM explicitly
+ if(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES)
+ list(REMOVE_ITEM CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES
+ ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}
+ )
+ endif()
endif()
# Re-configure to save learned information.
diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake
index f48107a..d67d8d3 100644
--- a/Modules/CheckLanguage.cmake
+++ b/Modules/CheckLanguage.cmake
@@ -43,7 +43,7 @@ macro(check_language lang)
file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang})
set(extra_compiler_variables)
- if(lang STREQUAL CUDA)
+ if(${lang} STREQUAL CUDA)
set(extra_compiler_variables "set(CMAKE_CUDA_HOST_COMPILER \\\"\${CMAKE_CUDA_HOST_COMPILER}\\\")")
endif()
diff --git a/Modules/Compiler/Absoft-Fortran.cmake b/Modules/Compiler/Absoft-Fortran.cmake
index 76502dc..8724f85 100644
--- a/Modules/Compiler/Absoft-Fortran.cmake
+++ b/Modules/Compiler/Absoft-Fortran.cmake
@@ -9,3 +9,5 @@ set(CMAKE_Fortran_VERBOSE_FLAG "-v")
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree")
set(CMAKE_Fortran_LINKER_WRAPPER_FLAG "-X")
+set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-cpp")
+set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-no-cpp")
diff --git a/Modules/Compiler/Clang-CUDA.cmake b/Modules/Compiler/Clang-CUDA.cmake
new file mode 100644
index 0000000..a970985
--- /dev/null
+++ b/Modules/Compiler/Clang-CUDA.cmake
@@ -0,0 +1,25 @@
+include(Compiler/Clang)
+__compiler_clang(CUDA)
+
+# C++03 isn't supported for CXX, but is for CUDA, so we need to set these manually.
+# Do this before __compiler_clang_cxx_standards() since that adds the feature.
+set(CMAKE_CUDA03_STANDARD_COMPILE_OPTION "-std=c++03")
+set(CMAKE_CUDA03_EXTENSION_COMPILE_OPTION "-std=gnu++03")
+__compiler_clang_cxx_standards(CUDA)
+
+set(CMAKE_CUDA_COMPILER_HAS_DEVICE_LINK_PHASE TRUE)
+set(_CMAKE_COMPILE_AS_CUDA_FLAG "-x cuda")
+set(_CMAKE_CUDA_PTX_FLAG "--cuda-device-only -S")
+
+# RulePlaceholderExpander expands crosscompile variables like sysroot and target only for CMAKE_<LANG>_COMPILER. Override the default.
+set(CMAKE_CUDA_LINK_EXECUTABLE "<CMAKE_CUDA_COMPILER> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_LINKS}")
+set(CMAKE_CUDA_CREATE_SHARED_LIBRARY "<CMAKE_CUDA_COMPILER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>${__IMPLICT_LINKS}")
+
+set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "STATIC")
+set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "cudadevrt;cudart_static")
+set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_SHARED "cudadevrt;cudart")
+set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_NONE "")
+
+if(UNIX)
+ list(APPEND CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "rt" "pthread" "dl")
+endif()
diff --git a/Modules/Compiler/Cray-Fortran.cmake b/Modules/Compiler/Cray-Fortran.cmake
index ccb7c2e..696ae76 100644
--- a/Modules/Compiler/Cray-Fortran.cmake
+++ b/Modules/Compiler/Cray-Fortran.cmake
@@ -11,3 +11,11 @@ set(CMAKE_Fortran_MODDIR_FLAG -J)
set(CMAKE_Fortran_MODDIR_DEFAULT .)
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-f fixed")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-f free")
+
+if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 8.5)
+ set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-eT")
+ set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-dT")
+else()
+ set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-eZ")
+ set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-dZ")
+endif()
diff --git a/Modules/Compiler/Flang-Fortran.cmake b/Modules/Compiler/Flang-Fortran.cmake
index f0e61d8..de0484e 100644
--- a/Modules/Compiler/Flang-Fortran.cmake
+++ b/Modules/Compiler/Flang-Fortran.cmake
@@ -11,3 +11,6 @@ set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed-form")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree-form")
set(CMAKE_Fortran_MODDIR_FLAG "-J")
+
+set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-cpp")
+set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-nocpp")
diff --git a/Modules/Compiler/G95-Fortran.cmake b/Modules/Compiler/G95-Fortran.cmake
index 03b7e08..5dba04e 100644
--- a/Modules/Compiler/G95-Fortran.cmake
+++ b/Modules/Compiler/G95-Fortran.cmake
@@ -9,3 +9,5 @@ set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed-form")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree-form")
set(CMAKE_Fortran_LINKER_WRAPPER_FLAG "-Wl,")
set(CMAKE_Fortran_LINKER_WRAPPER_FLAG_SEP ",")
+set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-cpp")
+set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-no-cpp")
diff --git a/Modules/Compiler/GNU-Fortran.cmake b/Modules/Compiler/GNU-Fortran.cmake
index 6413769..5dfb03e 100644
--- a/Modules/Compiler/GNU-Fortran.cmake
+++ b/Modules/Compiler/GNU-Fortran.cmake
@@ -10,6 +10,11 @@ set(CMAKE_Fortran_PREPROCESS_SOURCE
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed-form")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree-form")
+if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 4.4)
+ set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-cpp")
+ set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-nocpp")
+endif()
+
set(CMAKE_Fortran_POSTPROCESS_FLAG "-fpreprocessed")
# No -DNDEBUG for Fortran.
diff --git a/Modules/Compiler/HP-Fortran.cmake b/Modules/Compiler/HP-Fortran.cmake
index 63a0331..d3e2a30 100644
--- a/Modules/Compiler/HP-Fortran.cmake
+++ b/Modules/Compiler/HP-Fortran.cmake
@@ -7,3 +7,6 @@ set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES>
set(CMAKE_Fortran_LINKER_WRAPPER_FLAG "-Wl,")
set(CMAKE_Fortran_LINKER_WRAPPER_FLAG ",")
+
+set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "+cpp=yes")
+set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "+cpp=no")
diff --git a/Modules/Compiler/Intel-Fortran.cmake b/Modules/Compiler/Intel-Fortran.cmake
index 156b533..71f25f4 100644
--- a/Modules/Compiler/Intel-Fortran.cmake
+++ b/Modules/Compiler/Intel-Fortran.cmake
@@ -15,3 +15,5 @@ set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <IN
set(CMAKE_Fortran_PREPROCESS_SOURCE
"<CMAKE_Fortran_COMPILER> -fpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-fpp")
+set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-nofpp")
diff --git a/Modules/Compiler/NAG-Fortran.cmake b/Modules/Compiler/NAG-Fortran.cmake
index 2111c65..ffce97e 100644
--- a/Modules/Compiler/NAG-Fortran.cmake
+++ b/Modules/Compiler/NAG-Fortran.cmake
@@ -37,3 +37,4 @@ set(CMAKE_Fortran_FORMAT_FREE_FLAG "-free")
set(CMAKE_Fortran_COMPILE_OPTIONS_PIC "-PIC")
set(CMAKE_Fortran_COMPILE_OPTIONS_PIE "-PIC")
set(CMAKE_Fortran_RESPONSE_FILE_LINK_FLAG "-Wl,@")
+set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-fpp")
diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake
index 4b09e6f..87607e2 100644
--- a/Modules/Compiler/NVIDIA-CUDA.cmake
+++ b/Modules/Compiler/NVIDIA-CUDA.cmake
@@ -59,11 +59,14 @@ set(CMAKE_CUDA_DEVICE_COMPILER_WRAPPER_FLAG_SEP ",")
set(CMAKE_CUDA_DEVICE_LINKER_WRAPPER_FLAG "-Xlinker=")
set(CMAKE_CUDA_DEVICE_LINKER_WRAPPER_FLAG_SEP ",")
-set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "STATIC")
set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "cudadevrt;cudart_static")
set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_SHARED "cudadevrt;cudart")
set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_NONE "")
+if(UNIX)
+ list(APPEND CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "rt" "pthread" "dl")
+endif()
+
if("x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC")
set(CMAKE_CUDA03_STANDARD_COMPILE_OPTION "")
set(CMAKE_CUDA03_EXTENSION_COMPILE_OPTION "")
diff --git a/Modules/Compiler/PGI-Fortran.cmake b/Modules/Compiler/PGI-Fortran.cmake
index 3daf798..ff87577 100644
--- a/Modules/Compiler/PGI-Fortran.cmake
+++ b/Modules/Compiler/PGI-Fortran.cmake
@@ -6,6 +6,7 @@ set(CMAKE_Fortran_SUBMODULE_EXT ".mod")
set(CMAKE_Fortran_PREPROCESS_SOURCE
"<CMAKE_Fortran_COMPILER> -Mpreprocess <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-Mpreprocess")
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-Mnofreeform")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-Mfreeform")
diff --git a/Modules/Compiler/PathScale-Fortran.cmake b/Modules/Compiler/PathScale-Fortran.cmake
index d903621..891d93e 100644
--- a/Modules/Compiler/PathScale-Fortran.cmake
+++ b/Modules/Compiler/PathScale-Fortran.cmake
@@ -4,3 +4,6 @@ __compiler_pathscale(Fortran)
set(CMAKE_Fortran_MODDIR_FLAG "-module ")
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixedform")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-freeform")
+
+set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-cpp")
+set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-nocpp")
diff --git a/Modules/Compiler/SunPro-Fortran.cmake b/Modules/Compiler/SunPro-Fortran.cmake
index 0c93c94..0ba5015 100644
--- a/Modules/Compiler/SunPro-Fortran.cmake
+++ b/Modules/Compiler/SunPro-Fortran.cmake
@@ -30,3 +30,5 @@ set(CMAKE_Fortran_PREPROCESS_SOURCE
set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -F -fpp <SOURCE> -o <PREPROCESSED_SOURCE>")
set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+
+set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-fpp")
diff --git a/Modules/Compiler/XL-Fortran.cmake b/Modules/Compiler/XL-Fortran.cmake
index e01ec8e..cc15e65 100644
--- a/Modules/Compiler/XL-Fortran.cmake
+++ b/Modules/Compiler/XL-Fortran.cmake
@@ -23,3 +23,8 @@ set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE)
set(CMAKE_Fortran_PREPROCESS_SOURCE
"<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -qpreprocess -qnoobject -qsuppress=1517-020 -tF -B \"${CMAKE_CURRENT_LIST_DIR}/XL-Fortran/\" -WF,--cpp,\"${CMAKE_Fortran_XL_CPP}\",--out,<PREPROCESSED_SOURCE> <SOURCE>"
)
+
+if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 15.1.6)
+ set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-qpreprocess")
+ set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-qnopreprocess")
+endif()
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 75f68c8..f9f7a4f 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -2989,6 +2989,10 @@ function(_ep_extract_configure_command var name)
endif()
_ep_write_initial_cache(${name} "${_ep_cache_args_script}" "${script_initial_cache_force}${script_initial_cache_default}")
list(APPEND cmd "-C${_ep_cache_args_script}")
+ _ep_replace_location_tags(${name} _ep_cache_args_script)
+ set(_ep_cache_args_script
+ "${_ep_cache_args_script}"
+ PARENT_SCOPE)
endif()
list(APPEND cmd "<SOURCE_DIR><SOURCE_SUBDIR>")
diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake
index 400754c..45b50d4 100644
--- a/Modules/FetchContent.cmake
+++ b/Modules/FetchContent.cmake
@@ -108,9 +108,13 @@ Declaring Content Details
The ``<contentOptions>`` can be any of the download or update/patch options
that the :command:`ExternalProject_Add` command understands. The configure,
build, install and test steps are explicitly disabled and therefore options
- related to them will be ignored. In most cases, ``<contentOptions>`` will
- just be a couple of options defining the download method and method-specific
- details like a commit tag or archive hash. For example:
+ related to them will be ignored. The ``SOURCE_SUBDIR`` option is an
+ exception, see :command:`FetchContent_MakeAvailable` for details on how that
+ affects behavior.
+
+ In most cases, ``<contentOptions>`` will just be a couple of options defining
+ the download method and method-specific details like a commit tag or archive
+ hash. For example:
.. code-block:: cmake
@@ -164,8 +168,9 @@ approach. The former generally follows this canonical pattern:
The above is such a common pattern that, where no custom steps are needed
between the calls to :command:`FetchContent_Populate` and
:command:`add_subdirectory`, equivalent logic can be obtained by calling
-:command:`FetchContent_MakeAvailable` instead (and should be preferred where
-it meets the needs of the project).
+:command:`FetchContent_MakeAvailable` instead. Where it meets the needs of
+the project, :command:`FetchContent_MakeAvailable` should be preferred, as it
+is simpler and provides additional features over the pattern above.
.. command:: FetchContent_Populate
@@ -335,6 +340,8 @@ it meets the needs of the project).
``${CMAKE_CURRENT_BINARY_DIR}/<lcName>-subbuild`` and it would be unusual
to need to override this default. If a relative path is specified, it will
be interpreted as relative to :variable:`CMAKE_CURRENT_BINARY_DIR`.
+ This option should not be confused with the ``SOURCE_SUBDIR`` option which
+ only affects the :command:`FetchContent_MakeAvailable` command.
``SOURCE_DIR``, ``BINARY_DIR``
The ``SOURCE_DIR`` and ``BINARY_DIR`` arguments are supported by
@@ -409,15 +416,22 @@ it meets the needs of the project).
This command implements the common pattern typically needed for most
dependencies. It iterates over each of the named dependencies in turn
- and for each one it loosely follows the same
+ and for each one it loosely follows the
:ref:`canonical pattern <fetch-content-canonical-pattern>` as
- presented at the beginning of this section. One small difference to
- that pattern is that it will only call :command:`add_subdirectory` on the
+ presented at the beginning of this section. An important difference is
+ that :command:`add_subdirectory` will only be called on the
populated content if there is a ``CMakeLists.txt`` file in its top level
source directory. This allows the command to be used for dependencies
that make downloaded content available at a known location but which do
not need or support being added directly to the build.
+ The ``SOURCE_SUBDIR`` option can be given in the declared details to
+ instruct ``FetchContent_MakeAvailable()`` to look for a ``CMakeLists.txt``
+ file in a subdirectory below the top level (i.e. the same way that
+ ``SOURCE_SUBDIR`` is used by the :command:`ExternalProject_Add` command).
+ ``SOURCE_SUBDIR`` must always be a relative path. See the next section
+ for an example of this option.
+
.. _`fetch-content-examples`:
@@ -445,6 +459,23 @@ frameworks are available to the main build:
# Catch2 will be defined and available to the rest of the build
FetchContent_MakeAvailable(googletest Catch2)
+If the sub-project's ``CMakeLists.txt`` file is not at the top level of its
+source tree, the ``SOURCE_SUBDIR`` option can be used to tell ``FetchContent``
+where to find it. The following example shows how to use that option and
+it also sets a variable which is meaningful to the subproject before pulling
+it into the main build:
+
+.. code-block:: cmake
+
+ include(FetchContent)
+ FetchContent_Declare(
+ protobuf
+ GIT_REPOSITORY https://github.com/protocolbuffers/protobuf.git
+ GIT_TAG v3.12.0
+ SOURCE_SUBDIR cmake
+ )
+ set(protobuf_BUILD_TESTS OFF)
+ FetchContent_MakeAvailable(protobuf)
In more complex project hierarchies, the dependency relationships can be more
complicated. Consider a hierarchy where ``projA`` is the top level project and
@@ -1072,11 +1103,26 @@ macro(FetchContent_MakeAvailable)
# can be treated that way. Protecting the call with the check
# allows this function to be used for projects that just want
# to ensure the content exists, such as to provide content at
- # a known location.
- if(EXISTS ${${contentNameLower}_SOURCE_DIR}/CMakeLists.txt)
- add_subdirectory(${${contentNameLower}_SOURCE_DIR}
- ${${contentNameLower}_BINARY_DIR})
+ # a known location. We check the saved details for an optional
+ # SOURCE_SUBDIR which can be used in the same way as its meaning
+ # for ExternalProject. It won't matter if it was passed through
+ # to the ExternalProject sub-build, since it would have been
+ # ignored there.
+ set(__fc_srcdir "${${contentNameLower}_SOURCE_DIR}")
+ __FetchContent_getSavedDetails(${contentName} contentDetails)
+ if("${contentDetails}" STREQUAL "")
+ message(FATAL_ERROR "No details have been set for content: ${contentName}")
+ endif()
+ cmake_parse_arguments(__fc_arg "" "SOURCE_SUBDIR" "" ${contentDetails})
+ if(NOT "${__fc_arg_SOURCE_SUBDIR}" STREQUAL "")
+ string(APPEND __fc_srcdir "/${__fc_arg_SOURCE_SUBDIR}")
endif()
+
+ if(EXISTS ${__fc_srcdir}/CMakeLists.txt)
+ add_subdirectory(${__fc_srcdir} ${${contentNameLower}_BINARY_DIR})
+ endif()
+
+ unset(__fc_srcdir)
endif()
endforeach()
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 57e17b3..13981d3 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -754,7 +754,11 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret)
set(_boost_COMPILER "-mgw") # no GCC version encoding prior to 1.34
else()
_Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION _boost_COMPILER_VERSION_MAJOR _boost_COMPILER_VERSION_MINOR)
- set(_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}")
+ if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.73 AND _boost_COMPILER_VERSION_MAJOR VERSION_GREATER_EQUAL 5)
+ set(_boost_COMPILER "-mgw${_boost_COMPILER_VERSION_MAJOR}")
+ else()
+ set(_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}")
+ endif()
endif()
elseif (UNIX)
_Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION _boost_COMPILER_VERSION_MAJOR _boost_COMPILER_VERSION_MINOR)
@@ -1453,7 +1457,7 @@ else()
# _Boost_COMPONENT_HEADERS. See the instructions at the top of
# _Boost_COMPONENT_DEPENDENCIES.
set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
- "1.72.0" "1.72" "1.71.0" "1.71" "1.70.0" "1.70" "1.69.0" "1.69"
+ "1.73.0" "1.73" "1.72.0" "1.72" "1.71.0" "1.71" "1.70.0" "1.70" "1.69.0" "1.69"
"1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65"
"1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60"
"1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55"
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index 8d20ff9..b28892e 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -473,168 +473,8 @@ Result variables
#
###############################################################################
-# For NVCC we can easily deduce the SDK binary directory from the compiler path.
-if(CMAKE_CUDA_COMPILER_LOADED AND NOT CUDAToolkit_BIN_DIR AND CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
- get_filename_component(cuda_dir "${CMAKE_CUDA_COMPILER}" DIRECTORY)
- set(CUDAToolkit_BIN_DIR "${cuda_dir}" CACHE PATH "")
- mark_as_advanced(CUDAToolkit_BIN_DIR)
- unset(cuda_dir)
-endif()
-
-# Try language- or user-provided path first.
-if(CUDAToolkit_BIN_DIR)
- find_program(CUDAToolkit_NVCC_EXECUTABLE
- NAMES nvcc nvcc.exe
- PATHS ${CUDAToolkit_BIN_DIR}
- NO_DEFAULT_PATH
- )
-endif()
-
-# Search using CUDAToolkit_ROOT
-find_program(CUDAToolkit_NVCC_EXECUTABLE
- NAMES nvcc nvcc.exe
- PATHS ENV CUDA_PATH
- PATH_SUFFIXES bin
-)
-
-# If the user specified CUDAToolkit_ROOT but nvcc could not be found, this is an error.
-if (NOT CUDAToolkit_NVCC_EXECUTABLE AND (DEFINED CUDAToolkit_ROOT OR DEFINED ENV{CUDAToolkit_ROOT}))
- # Declare error messages now, print later depending on find_package args.
- set(fail_base "Could not find nvcc executable in path specified by")
- set(cuda_root_fail "${fail_base} CUDAToolkit_ROOT=${CUDAToolkit_ROOT}")
- set(env_cuda_root_fail "${fail_base} environment variable CUDAToolkit_ROOT=$ENV{CUDAToolkit_ROOT}")
-
- if (CUDAToolkit_FIND_REQUIRED)
- if (DEFINED CUDAToolkit_ROOT)
- message(FATAL_ERROR ${cuda_root_fail})
- elseif (DEFINED ENV{CUDAToolkit_ROOT})
- message(FATAL_ERROR ${env_cuda_root_fail})
- endif()
- else()
- if (NOT CUDAToolkit_FIND_QUIETLY)
- if (DEFINED CUDAToolkit_ROOT)
- message(STATUS ${cuda_root_fail})
- elseif (DEFINED ENV{CUDAToolkit_ROOT})
- message(STATUS ${env_cuda_root_fail})
- endif()
- endif()
- set(CUDAToolkit_FOUND FALSE)
- unset(fail_base)
- unset(cuda_root_fail)
- unset(env_cuda_root_fail)
- return()
- endif()
-endif()
-
-# CUDAToolkit_ROOT cmake / env variable not specified, try platform defaults.
-#
-# - Linux: /usr/local/cuda-X.Y
-# - macOS: /Developer/NVIDIA/CUDA-X.Y
-# - Windows: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\vX.Y
-#
-# We will also search the default symlink location /usr/local/cuda first since
-# if CUDAToolkit_ROOT is not specified, it is assumed that the symlinked
-# directory is the desired location.
-if (NOT CUDAToolkit_NVCC_EXECUTABLE)
- if (UNIX)
- if (NOT APPLE)
- set(platform_base "/usr/local/cuda-")
- else()
- set(platform_base "/Developer/NVIDIA/CUDA-")
- endif()
- else()
- set(platform_base "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v")
- endif()
-
- # Build out a descending list of possible cuda installations, e.g.
- file(GLOB possible_paths "${platform_base}*")
- # Iterate the glob results and create a descending list.
- set(possible_versions)
- foreach (p ${possible_paths})
- # Extract version number from end of string
- string(REGEX MATCH "[0-9][0-9]?\\.[0-9]$" p_version ${p})
- if (IS_DIRECTORY ${p} AND p_version)
- list(APPEND possible_versions ${p_version})
- endif()
- endforeach()
-
- # Cannot use list(SORT) because that is alphabetical, we need numerical.
- # NOTE: this is not an efficient sorting strategy. But even if a user had
- # every possible version of CUDA installed, this wouldn't create any
- # significant overhead.
- set(versions)
- foreach (v ${possible_versions})
- list(LENGTH versions num_versions)
- # First version, nothing to compare with so just append.
- if (num_versions EQUAL 0)
- list(APPEND versions ${v})
- else()
- # Loop through list. Insert at an index when comparison is
- # VERSION_GREATER since we want a descending list. Duplicates will not
- # happen since this came from a glob list of directories.
- set(i 0)
- set(early_terminate FALSE)
- while (i LESS num_versions)
- list(GET versions ${i} curr)
- if (v VERSION_GREATER curr)
- list(INSERT versions ${i} ${v})
- set(early_terminate TRUE)
- break()
- endif()
- math(EXPR i "${i} + 1")
- endwhile()
- # If it did not get inserted, place it at the end.
- if (NOT early_terminate)
- list(APPEND versions ${v})
- endif()
- endif()
- endforeach()
-
- # With a descending list of versions, populate possible paths to search.
- set(search_paths)
- foreach (v ${versions})
- list(APPEND search_paths "${platform_base}${v}")
- endforeach()
-
- # Force the global default /usr/local/cuda to the front on Unix.
- if (UNIX)
- list(INSERT search_paths 0 "/usr/local/cuda")
- endif()
-
- # Now search for nvcc again using the platform default search paths.
- find_program(CUDAToolkit_NVCC_EXECUTABLE
- NAMES nvcc nvcc.exe
- PATHS ${search_paths}
- PATH_SUFFIXES bin
- )
-
- # We are done with these variables now, cleanup for caller.
- unset(platform_base)
- unset(possible_paths)
- unset(possible_versions)
- unset(versions)
- unset(i)
- unset(early_terminate)
- unset(search_paths)
-
- if (NOT CUDAToolkit_NVCC_EXECUTABLE)
- if (CUDAToolkit_FIND_REQUIRED)
- message(FATAL_ERROR "Could not find nvcc, please set CUDAToolkit_ROOT.")
- elseif(NOT CUDAToolkit_FIND_QUIETLY)
- message(STATUS "Could not find nvcc, please set CUDAToolkit_ROOT.")
- endif()
-
- set(CUDAToolkit_FOUND FALSE)
- return()
- endif()
-endif()
-
-if(NOT CUDAToolkit_BIN_DIR AND CUDAToolkit_NVCC_EXECUTABLE)
- get_filename_component(cuda_dir "${CUDAToolkit_NVCC_EXECUTABLE}" DIRECTORY)
- set(CUDAToolkit_BIN_DIR "${cuda_dir}" CACHE PATH "" FORCE)
- mark_as_advanced(CUDAToolkit_BIN_DIR)
- unset(cuda_dir)
-endif()
+# Include shared CUDA toolkit location code.
+include(Internal/CUDAToolkit)
if(CUDAToolkit_NVCC_EXECUTABLE AND
CUDAToolkit_NVCC_EXECUTABLE STREQUAL CMAKE_CUDA_COMPILER)
@@ -658,72 +498,22 @@ else()
unset(NVCC_OUT)
endif()
-
-get_filename_component(CUDAToolkit_ROOT_DIR ${CUDAToolkit_BIN_DIR} DIRECTORY ABSOLUTE)
-
-# Handle cross compilation
-if(CMAKE_CROSSCOMPILING)
- if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7-a")
- # Support for NVPACK
- set (CUDAToolkit_TARGET_NAME "armv7-linux-androideabi")
- elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
- # Support for arm cross compilation
- set(CUDAToolkit_TARGET_NAME "armv7-linux-gnueabihf")
- elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
- # Support for aarch64 cross compilation
- if (ANDROID_ARCH_NAME STREQUAL "arm64")
- set(CUDAToolkit_TARGET_NAME "aarch64-linux-androideabi")
- else()
- set(CUDAToolkit_TARGET_NAME "aarch64-linux")
- endif (ANDROID_ARCH_NAME STREQUAL "arm64")
- elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
- set(CUDAToolkit_TARGET_NAME "x86_64-linux")
- endif()
-
- if (EXISTS "${CUDAToolkit_ROOT_DIR}/targets/${CUDAToolkit_TARGET_NAME}")
- set(CUDAToolkit_TARGET_DIR "${CUDAToolkit_ROOT_DIR}/targets/${CUDAToolkit_TARGET_NAME}")
- # add known CUDA target root path to the set of directories we search for programs, libraries and headers
- list(PREPEND CMAKE_FIND_ROOT_PATH "${CUDAToolkit_TARGET_DIR}")
-
- # Mark that we need to pop the root search path changes after we have
- # found all cuda libraries so that searches for our cross-compilation
- # libraries work when another cuda sdk is in CMAKE_PREFIX_PATH or
- # PATh
- set(_CUDAToolkit_Pop_ROOT_PATH True)
- endif()
-else()
- # Not cross compiling
- set(CUDAToolkit_TARGET_DIR "${CUDAToolkit_ROOT_DIR}")
- # Now that we have the real ROOT_DIR, find components inside it.
- list(APPEND CMAKE_PREFIX_PATH ${CUDAToolkit_ROOT_DIR})
-
- # Mark that we need to pop the prefix path changes after we have
- # found the cudart library.
- set(_CUDAToolkit_Pop_Prefix True)
+if(NOT CUDA_CUDART AND NOT CUDAToolkit_FIND_QUIETLY)
+ message(STATUS "Unable to find cudart library.")
endif()
-
-# Find the include/ directory
-find_path(CUDAToolkit_INCLUDE_DIR
- NAMES cuda_runtime.h
-)
-
-# And find the CUDA Runtime Library libcudart
+# Find the CUDA Runtime Library libcudart
find_library(CUDA_CUDART
NAMES cudart
PATH_SUFFIXES lib64 lib/x64
)
-if (NOT CUDA_CUDART)
+if(NOT CUDA_CUDART)
find_library(CUDA_CUDART
NAMES cudart
PATH_SUFFIXES lib64/stubs lib/x64/stubs
)
endif()
-if (NOT CUDA_CUDART AND NOT CUDAToolkit_FIND_QUIETLY)
- message(STATUS "Unable to find cudart library.")
-endif()
-
unset(CUDAToolkit_ROOT_DIR)
if(_CUDAToolkit_Pop_Prefix)
list(REMOVE_AT CMAKE_PREFIX_PATH -1)
@@ -749,8 +539,8 @@ mark_as_advanced(CUDA_CUDART
#-----------------------------------------------------------------------------
# Construct result variables
if(CUDAToolkit_FOUND)
- set(CUDAToolkit_INCLUDE_DIRS ${CUDAToolkit_INCLUDE_DIR})
- get_filename_component(CUDAToolkit_LIBRARY_DIR ${CUDA_CUDART} DIRECTORY ABSOLUTE)
+ set(CUDAToolkit_INCLUDE_DIRS ${CUDAToolkit_INCLUDE_DIR})
+ get_filename_component(CUDAToolkit_LIBRARY_DIR ${CUDA_CUDART} DIRECTORY ABSOLUTE)
endif()
#-----------------------------------------------------------------------------
diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake
index faa03f9..184a9a2 100644
--- a/Modules/FindDoxygen.cmake
+++ b/Modules/FindDoxygen.cmake
@@ -999,9 +999,11 @@ doxygen_add_docs() for target ${targetName}")
foreach(_item IN LISTS DOXYGEN_INPUT)
get_filename_component(_abs_item "${_item}" ABSOLUTE
BASE_DIR "${_args_WORKING_DIRECTORY}")
- if(EXISTS "${_abs_item}" AND
- NOT IS_DIRECTORY "${_abs_item}" AND
- NOT IS_SYMLINK "${_abs_item}")
+ get_source_file_property(_isGenerated "${_abs_item}" GENERATED)
+ if(_isGenerated OR
+ (EXISTS "${_abs_item}" AND
+ NOT IS_DIRECTORY "${_abs_item}" AND
+ NOT IS_SYMLINK "${_abs_item}"))
list(APPEND _sources "${_abs_item}")
elseif(_args_USE_STAMP_FILE)
message(FATAL_ERROR "Source does not exist or is not a file:\n"
diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake
index 565763d..62f1614 100644
--- a/Modules/FindGTK2.cmake
+++ b/Modules/FindGTK2.cmake
@@ -695,11 +695,14 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
_GTK2_FIND_LIBRARY (CAIRO cairo false false)
_GTK2_ADD_TARGET (CAIRO)
+ _GTK2_FIND_INCLUDE_DIR(HARFBUZZ hb.h)
+ _GTK2_FIND_LIBRARY (HARFBUZZ harfbuzz false false)
+ _GTK2_ADD_TARGET (HARFBUZZ)
+
_GTK2_FIND_INCLUDE_DIR(PANGO pango/pango.h)
_GTK2_FIND_LIBRARY (PANGO pango false true)
- _GTK2_ADD_TARGET (PANGO GTK2_DEPENDS gobject glib)
-
- _GTK2_FIND_INCLUDE_DIR(HARFBUZZ hb.h)
+ _GTK2_ADD_TARGET (PANGO GTK2_DEPENDS gobject glib
+ GTK2_OPTIONAL_DEPENDS harfbuzz)
_GTK2_FIND_LIBRARY (PANGOCAIRO pangocairo false true)
_GTK2_ADD_TARGET (PANGOCAIRO GTK2_DEPENDS pango cairo gobject glib)
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index c1888a4..8d71d27 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -36,7 +36,7 @@ Both the serial and parallel ``HDF5`` wrappers are considered and the first
directory to contain either one will be used. In the event that both appear
in the same directory the serial version is preferentially selected. This
behavior can be reversed by setting the variable ``HDF5_PREFER_PARALLEL`` to
-``True``.
+``TRUE``.
In addition to finding the includes and libraries required to compile
an ``HDF5`` client application, this module also makes an effort to find
@@ -139,28 +139,30 @@ if(NOT HDF5_FIND_COMPONENTS)
else()
set(HDF5_LANGUAGE_BINDINGS)
# add the extra specified components, ensuring that they are valid.
- set(FIND_HL OFF)
- foreach(component IN LISTS HDF5_FIND_COMPONENTS)
- list(FIND HDF5_VALID_LANGUAGE_BINDINGS ${component} component_location)
- if(NOT component_location EQUAL -1)
- list(APPEND HDF5_LANGUAGE_BINDINGS ${component})
- elseif(component STREQUAL "HL")
- set(FIND_HL ON)
- elseif(component STREQUAL "Fortran_HL") # only for compatibility
+ set(HDF5_FIND_HL OFF)
+ foreach(_component IN LISTS HDF5_FIND_COMPONENTS)
+ list(FIND HDF5_VALID_LANGUAGE_BINDINGS ${_component} _component_location)
+ if(NOT _component_location EQUAL -1)
+ list(APPEND HDF5_LANGUAGE_BINDINGS ${_component})
+ elseif(_component STREQUAL "HL")
+ set(HDF5_FIND_HL ON)
+ elseif(_component STREQUAL "Fortran_HL") # only for compatibility
list(APPEND HDF5_LANGUAGE_BINDINGS Fortran)
- set(FIND_HL ON)
- set(HDF5_FIND_REQUIRED_Fortran_HL False)
- set(HDF5_FIND_REQUIRED_Fortran True)
- set(HDF5_FIND_REQUIRED_HL True)
+ set(HDF5_FIND_HL ON)
+ set(HDF5_FIND_REQUIRED_Fortran_HL FALSE)
+ set(HDF5_FIND_REQUIRED_Fortran TRUE)
+ set(HDF5_FIND_REQUIRED_HL TRUE)
else()
- message(FATAL_ERROR "${component} is not a valid HDF5 component.")
+ message(FATAL_ERROR "${_component} is not a valid HDF5 component.")
endif()
endforeach()
+ unset(_component)
+ unset(_component_location)
if(NOT HDF5_LANGUAGE_BINDINGS)
- get_property(__langs GLOBAL PROPERTY ENABLED_LANGUAGES)
- foreach(__lang IN LISTS __langs)
- if(__lang MATCHES "^(C|CXX|Fortran)$")
- list(APPEND HDF5_LANGUAGE_BINDINGS ${__lang})
+ get_property(_langs GLOBAL PROPERTY ENABLED_LANGUAGES)
+ foreach(_lang IN LISTS _langs)
+ if(_lang MATCHES "^(C|CXX|Fortran)$")
+ list(APPEND HDF5_LANGUAGE_BINDINGS ${_lang})
endif()
endforeach()
endif()
@@ -326,108 +328,109 @@ endfunction()
# Invoke the HDF5 wrapper compiler. The compiler return value is stored to the
# return_value argument, the text output is stored to the output variable.
-macro( _HDF5_invoke_compiler language output return_value version is_parallel)
- set(${version})
- if(HDF5_USE_STATIC_LIBRARIES)
- set(lib_type_args -noshlib)
- else()
- set(lib_type_args -shlib)
- endif()
- set(scratch_dir ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5)
- if("${language}" STREQUAL "C")
- set(test_file ${scratch_dir}/cmake_hdf5_test.c)
- elseif("${language}" STREQUAL "CXX")
- set(test_file ${scratch_dir}/cmake_hdf5_test.cxx)
- elseif("${language}" STREQUAL "Fortran")
- set(test_file ${scratch_dir}/cmake_hdf5_test.f90)
+function( _HDF5_invoke_compiler language output_var return_value_var version_var is_parallel_var)
+ set(is_parallel FALSE)
+ if(HDF5_USE_STATIC_LIBRARIES)
+ set(lib_type_args -noshlib)
+ else()
+ set(lib_type_args -shlib)
+ endif()
+ set(scratch_dir ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5)
+ if("${language}" STREQUAL "C")
+ set(test_file ${scratch_dir}/cmake_hdf5_test.c)
+ elseif("${language}" STREQUAL "CXX")
+ set(test_file ${scratch_dir}/cmake_hdf5_test.cxx)
+ elseif("${language}" STREQUAL "Fortran")
+ set(test_file ${scratch_dir}/cmake_hdf5_test.f90)
+ endif()
+ # Verify that the compiler wrapper can actually compile: sometimes the compiler
+ # wrapper exists, but not the compiler. E.g. Miniconda / Anaconda Python
+ execute_process(
+ COMMAND ${HDF5_${language}_COMPILER_EXECUTABLE} ${test_file}
+ RESULT_VARIABLE return_value
+ )
+ if(return_value)
+ message(STATUS
+ "HDF5 ${language} compiler wrapper is unable to compile a minimal HDF5 program.")
+ else()
+ execute_process(
+ COMMAND ${HDF5_${language}_COMPILER_EXECUTABLE} -show ${lib_type_args} ${test_file}
+ OUTPUT_VARIABLE output
+ ERROR_VARIABLE output
+ RESULT_VARIABLE return_value
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ if(return_value)
+ message(STATUS
+ "Unable to determine HDF5 ${language} flags from HDF5 wrapper.")
endif()
- # Verify that the compiler wrapper can actually compile: sometimes the compiler
- # wrapper exists, but not the compiler. E.g. Miniconda / Anaconda Python
execute_process(
- COMMAND ${HDF5_${language}_COMPILER_EXECUTABLE} ${test_file}
- RESULT_VARIABLE ${return_value}
+ COMMAND ${HDF5_${language}_COMPILER_EXECUTABLE} -showconfig
+ OUTPUT_VARIABLE config_output
+ ERROR_VARIABLE config_output
+ RESULT_VARIABLE return_value
+ OUTPUT_STRIP_TRAILING_WHITESPACE
)
- if(NOT ${${return_value}} EQUAL 0)
+ if(return_value)
message(STATUS
- "HDF5 ${language} compiler wrapper is unable to compile a minimal HDF5 program.")
- else()
- execute_process(
- COMMAND ${HDF5_${language}_COMPILER_EXECUTABLE} -show ${lib_type_args} ${test_file}
- OUTPUT_VARIABLE ${output}
- ERROR_VARIABLE ${output}
- RESULT_VARIABLE ${return_value}
- )
- if(NOT ${${return_value}} EQUAL 0)
- message(STATUS
- "Unable to determine HDF5 ${language} flags from HDF5 wrapper.")
- endif()
- execute_process(
- COMMAND ${HDF5_${language}_COMPILER_EXECUTABLE} -showconfig
- OUTPUT_VARIABLE config_output
- ERROR_VARIABLE config_output
- RESULT_VARIABLE config_return
- )
- if(NOT ${return_value} EQUAL 0)
- message( STATUS
- "Unable to determine HDF5 ${language} version from HDF5 wrapper.")
- endif()
- string(REGEX MATCH "HDF5 Version: ([a-zA-Z0-9\\.\\-]*)" version_match "${config_output}")
- if(version_match)
- string(REPLACE "HDF5 Version: " "" ${version} "${version_match}")
- string(REPLACE "-patch" "." ${version} "${${version}}")
- endif()
- if(config_output MATCHES "Parallel HDF5: yes")
- set(${is_parallel} TRUE)
- else()
- set(${is_parallel} FALSE)
- endif()
+ "Unable to determine HDF5 ${language} version_var from HDF5 wrapper.")
endif()
-endmacro()
+ string(REGEX MATCH "HDF5 Version: ([a-zA-Z0-9\\.\\-]*)" version "${config_output}")
+ if(version)
+ string(REPLACE "HDF5 Version: " "" version "${version}")
+ string(REPLACE "-patch" "." version "${version}")
+ endif()
+ if(config_output MATCHES "Parallel HDF5: yes")
+ set(is_parallel TRUE)
+ endif()
+ endif()
+ foreach(var output return_value version is_parallel)
+ set(${${var}_var} ${${var}} PARENT_SCOPE)
+ endforeach()
+endfunction()
# Parse a compile line for definitions, includes, library paths, and libraries.
-macro( _HDF5_parse_compile_line
- compile_line_var
- include_paths
- definitions
- library_paths
- libraries
- libraries_hl)
-
- separate_arguments(_HDF5_COMPILE_ARGS NATIVE_COMMAND "${${compile_line_var}}")
-
- foreach(arg IN LISTS _HDF5_COMPILE_ARGS)
- if("${arg}" MATCHES "^-I(.*)$")
+function(_HDF5_parse_compile_line compile_line_var include_paths definitions
+ library_paths libraries libraries_hl)
+
+ separate_arguments(_compile_args NATIVE_COMMAND "${${compile_line_var}}")
+
+ foreach(_arg IN LISTS _compile_args)
+ if("${_arg}" MATCHES "^-I(.*)$")
# include directory
- list(APPEND ${include_paths} "${CMAKE_MATCH_1}")
- elseif("${arg}" MATCHES "^-D(.*)$")
+ list(APPEND include_paths "${CMAKE_MATCH_1}")
+ elseif("${_arg}" MATCHES "^-D(.*)$")
# compile definition
- list(APPEND ${definitions} "-D${CMAKE_MATCH_1}")
- elseif("${arg}" MATCHES "^-L(.*)$")
+ list(APPEND definitions "-D${CMAKE_MATCH_1}")
+ elseif("${_arg}" MATCHES "^-L(.*)$")
# library search path
- list(APPEND ${library_paths} "${CMAKE_MATCH_1}")
- elseif("${arg}" MATCHES "^-l(hdf5.*hl.*)$")
+ 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(.*)$")
+ 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)$")
+ list(APPEND libraries "${CMAKE_MATCH_1}")
+ elseif("${_arg}" MATCHES "^(.:)?[/\\].*\\.(a|so|dylib|sl|lib)$")
# library file
- if(NOT EXISTS "${arg}")
+ 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}")
+ get_filename_component(_lpath "${_arg}" DIRECTORY)
+ get_filename_component(_lname "${_arg}" NAME_WE)
+ string(REGEX REPLACE "^lib" "" _lname "${_lname}")
+ list(APPEND library_paths "${_lpath}")
+ if(_lname MATCHES "hdf5.*hl")
+ list(APPEND libraries_hl "${_lname}")
else()
- list(APPEND ${libraries} "${_HDF5_LNAME}")
+ list(APPEND libraries "${_lname}")
endif()
endif()
endforeach()
-endmacro()
+ foreach(var include_paths definitions library_paths libraries libraries_hl)
+ set(${${var}_var} ${${var}} PARENT_SCOPE)
+ endforeach()
+endfunction()
# Select a preferred imported configuration from a target
function(_HDF5_select_imported_config target imported_conf)
@@ -537,10 +540,10 @@ if(NOT HDF5_FOUND AND NOT HDF5_NO_FIND_PACKAGE_CONFIG_FILE)
set(HDF5_${_lang}_LIBRARY ${_hdf5_lang_location})
list(APPEND HDF5_LIBRARIES ${HDF5_${_lang}_TARGET}${_suffix})
set(HDF5_${_lang}_LIBRARIES ${HDF5_${_lang}_TARGET}${_suffix})
- set(HDF5_${_lang}_FOUND True)
+ set(HDF5_${_lang}_FOUND TRUE)
endif()
- if(FIND_HL)
- get_target_property(__lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} IMPORTED_IMPLIB_${_hdf5_imported_conf} )
+ if(HDF5_FIND_HL)
+ get_target_property(_lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} IMPORTED_IMPLIB_${_hdf5_imported_conf} )
if (NOT _hdf5_lang_hl_location)
get_target_property(_hdf5_lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} LOCATION_${_hdf5_imported_conf})
if (NOT _hdf5_hl_lang_location)
@@ -551,7 +554,7 @@ if(NOT HDF5_FOUND AND NOT HDF5_NO_FIND_PACKAGE_CONFIG_FILE)
set(HDF5_${_lang}_HL_LIBRARY ${_hdf5_lang_hl_location})
list(APPEND HDF5_HL_LIBRARIES ${HDF5_${_lang}_HL_TARGET}${_suffix})
set(HDF5_${_lang}_HL_LIBRARIES ${HDF5_${_lang}_HL_TARGET}${_suffix})
- set(HDF5_HL_FOUND True)
+ set(HDF5_HL_FOUND TRUE)
endif()
unset(_hdf5_lang_hl_location)
endif()
@@ -562,172 +565,177 @@ if(NOT HDF5_FOUND AND NOT HDF5_NO_FIND_PACKAGE_CONFIG_FILE)
endif()
if(NOT HDF5_FOUND)
- set(_HDF5_NEED_TO_SEARCH False)
- set(HDF5_COMPILER_NO_INTERROGATE True)
+ set(_HDF5_NEED_TO_SEARCH FALSE)
+ set(HDF5_COMPILER_NO_INTERROGATE TRUE)
# Only search for languages we've enabled
- foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS)
+ foreach(_lang IN LISTS HDF5_LANGUAGE_BINDINGS)
# First check to see if our regular compiler is one of wrappers
- if(__lang STREQUAL "C")
+ if(_lang STREQUAL "C")
_HDF5_test_regular_compiler_C(
- HDF5_${__lang}_COMPILER_NO_INTERROGATE
- HDF5_${__lang}_VERSION
- HDF5_${__lang}_IS_PARALLEL)
- elseif(__lang STREQUAL "CXX")
+ HDF5_${_lang}_COMPILER_NO_INTERROGATE
+ HDF5_${_lang}_VERSION
+ HDF5_${_lang}_IS_PARALLEL)
+ elseif(_lang STREQUAL "CXX")
_HDF5_test_regular_compiler_CXX(
- HDF5_${__lang}_COMPILER_NO_INTERROGATE
- HDF5_${__lang}_VERSION
- HDF5_${__lang}_IS_PARALLEL)
- elseif(__lang STREQUAL "Fortran")
+ HDF5_${_lang}_COMPILER_NO_INTERROGATE
+ HDF5_${_lang}_VERSION
+ HDF5_${_lang}_IS_PARALLEL)
+ elseif(_lang STREQUAL "Fortran")
_HDF5_test_regular_compiler_Fortran(
- HDF5_${__lang}_COMPILER_NO_INTERROGATE
- HDF5_${__lang}_IS_PARALLEL)
+ HDF5_${_lang}_COMPILER_NO_INTERROGATE
+ HDF5_${_lang}_IS_PARALLEL)
else()
continue()
endif()
- if(HDF5_${__lang}_COMPILER_NO_INTERROGATE)
- message(STATUS "HDF5: Using hdf5 compiler wrapper for all ${__lang} compiling")
- set(HDF5_${__lang}_FOUND True)
- set(HDF5_${__lang}_COMPILER_EXECUTABLE_NO_INTERROGATE
- "${CMAKE_${__lang}_COMPILER}"
- CACHE FILEPATH "HDF5 ${__lang} compiler wrapper")
- set(HDF5_${__lang}_DEFINITIONS)
- set(HDF5_${__lang}_INCLUDE_DIRS)
- set(HDF5_${__lang}_LIBRARIES)
- set(HDF5_${__lang}_HL_LIBRARIES)
-
- mark_as_advanced(HDF5_${__lang}_COMPILER_EXECUTABLE_NO_INTERROGATE)
-
- set(HDF5_${__lang}_FOUND True)
- set(HDF5_HL_FOUND True)
+ if(HDF5_${_lang}_COMPILER_NO_INTERROGATE)
+ if(HDF5_FIND_DEBUG)
+ message(STATUS "HDF5: Using hdf5 compiler wrapper for all ${_lang} compiling")
+ endif()
+ set(HDF5_${_lang}_FOUND TRUE)
+ set(HDF5_${_lang}_COMPILER_EXECUTABLE_NO_INTERROGATE
+ "${CMAKE_${_lang}_COMPILER}"
+ CACHE FILEPATH "HDF5 ${_lang} compiler wrapper")
+ set(HDF5_${_lang}_DEFINITIONS)
+ set(HDF5_${_lang}_INCLUDE_DIRS)
+ set(HDF5_${_lang}_LIBRARIES)
+ set(HDF5_${_lang}_HL_LIBRARIES)
+
+ mark_as_advanced(HDF5_${_lang}_COMPILER_EXECUTABLE_NO_INTERROGATE)
+
+ set(HDF5_${_lang}_FOUND TRUE)
+ set(HDF5_HL_FOUND TRUE)
else()
- set(HDF5_COMPILER_NO_INTERROGATE False)
+ set(HDF5_COMPILER_NO_INTERROGATE FALSE)
# If this language isn't using the wrapper, then try to seed the
# search options with the wrapper
- find_program(HDF5_${__lang}_COMPILER_EXECUTABLE
- NAMES ${HDF5_${__lang}_COMPILER_NAMES} NAMES_PER_DIR
+ 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."
+ 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)
-
- if(HDF5_${__lang}_COMPILER_EXECUTABLE)
- _HDF5_invoke_compiler(${__lang} HDF5_${__lang}_COMPILE_LINE
- HDF5_${__lang}_RETURN_VALUE HDF5_${__lang}_VERSION HDF5_${__lang}_IS_PARALLEL)
- if(HDF5_${__lang}_RETURN_VALUE EQUAL 0)
- message(STATUS "HDF5: Using hdf5 compiler wrapper to determine ${__lang} configuration")
- _HDF5_parse_compile_line( HDF5_${__lang}_COMPILE_LINE
- HDF5_${__lang}_INCLUDE_DIRS
- HDF5_${__lang}_DEFINITIONS
- HDF5_${__lang}_LIBRARY_DIRS
- HDF5_${__lang}_LIBRARY_NAMES
- HDF5_${__lang}_HL_LIBRARY_NAMES
+ mark_as_advanced( HDF5_${_lang}_COMPILER_EXECUTABLE )
+ unset(HDF5_${_lang}_COMPILER_NAMES)
+
+ if(HDF5_${_lang}_COMPILER_EXECUTABLE)
+ _HDF5_invoke_compiler(${_lang} HDF5_${_lang}_COMPILE_LINE
+ HDF5_${_lang}_RETURN_VALUE HDF5_${_lang}_VERSION HDF5_${_lang}_IS_PARALLEL)
+ if(HDF5_${_lang}_RETURN_VALUE EQUAL 0)
+ if(HDF5_FIND_DEBUG)
+ message(STATUS "HDF5: Using hdf5 compiler wrapper to determine ${_lang} configuration")
+ endif()
+ _HDF5_parse_compile_line( HDF5_${_lang}_COMPILE_LINE
+ HDF5_${_lang}_INCLUDE_DIRS
+ HDF5_${_lang}_DEFINITIONS
+ HDF5_${_lang}_LIBRARY_DIRS
+ HDF5_${_lang}_LIBRARY_NAMES
+ HDF5_${_lang}_HL_LIBRARY_NAMES
)
- set(HDF5_${__lang}_LIBRARIES)
+ set(HDF5_${_lang}_LIBRARIES)
- foreach(L IN LISTS HDF5_${__lang}_LIBRARY_NAMES)
+ foreach(_lib IN LISTS HDF5_${_lang}_LIBRARY_NAMES)
set(_HDF5_SEARCH_NAMES_LOCAL)
- if("x${L}" MATCHES "hdf5")
+ if("x${_lib}" MATCHES "hdf5")
# hdf5 library
set(_HDF5_SEARCH_OPTS_LOCAL ${_HDF5_SEARCH_OPTS})
if(HDF5_USE_STATIC_LIBRARIES)
if(WIN32)
- set(_HDF5_SEARCH_NAMES_LOCAL lib${L})
+ set(_HDF5_SEARCH_NAMES_LOCAL lib${_lib})
else()
- set(_HDF5_SEARCH_NAMES_LOCAL lib${L}.a)
+ set(_HDF5_SEARCH_NAMES_LOCAL lib${_lib}.a)
endif()
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}
+ find_library(HDF5_${_lang}_LIBRARY_${_lib}
+ NAMES ${_HDF5_SEARCH_NAMES_LOCAL} ${_lib} 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}})
+ if(HDF5_${_lang}_LIBRARY_${_lib})
+ list(APPEND HDF5_${_lang}_LIBRARIES ${HDF5_${_lang}_LIBRARY_${_lib}})
else()
- list(APPEND HDF5_${__lang}_LIBRARIES ${L})
+ list(APPEND HDF5_${_lang}_LIBRARIES ${_lib})
endif()
endforeach()
- if(FIND_HL)
- set(HDF5_${__lang}_HL_LIBRARIES)
- foreach(L IN LISTS HDF5_${__lang}_HL_LIBRARY_NAMES)
+ if(HDF5_FIND_HL)
+ set(HDF5_${_lang}_HL_LIBRARIES)
+ foreach(_lib IN LISTS HDF5_${_lang}_HL_LIBRARY_NAMES)
set(_HDF5_SEARCH_NAMES_LOCAL)
- if("x${L}" MATCHES "hdf5")
+ if("x${_lib}" MATCHES "hdf5")
# hdf5 library
set(_HDF5_SEARCH_OPTS_LOCAL ${_HDF5_SEARCH_OPTS})
if(HDF5_USE_STATIC_LIBRARIES)
if(WIN32)
- set(_HDF5_SEARCH_NAMES_LOCAL lib${L})
+ set(_HDF5_SEARCH_NAMES_LOCAL lib${_lib})
else()
- set(_HDF5_SEARCH_NAMES_LOCAL lib${L}.a)
+ set(_HDF5_SEARCH_NAMES_LOCAL lib${_lib}.a)
endif()
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}
+ find_library(HDF5_${_lang}_LIBRARY_${_lib}
+ NAMES ${_HDF5_SEARCH_NAMES_LOCAL} ${_lib} 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}})
+ if(HDF5_${_lang}_LIBRARY_${_lib})
+ list(APPEND HDF5_${_lang}_HL_LIBRARIES ${HDF5_${_lang}_LIBRARY_${_lib}})
else()
- list(APPEND HDF5_${__lang}_HL_LIBRARIES ${L})
+ list(APPEND HDF5_${_lang}_HL_LIBRARIES ${_lib})
endif()
endforeach()
- set(HDF5_HL_FOUND True)
+ set(HDF5_HL_FOUND TRUE)
endif()
- set(HDF5_${__lang}_FOUND True)
- _HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_DEFINITIONS)
- _HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_INCLUDE_DIRS)
- _HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_LIBRARIES)
- _HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_HL_LIBRARIES)
+ set(HDF5_${_lang}_FOUND TRUE)
+ _HDF5_remove_duplicates_from_beginning(HDF5_${_lang}_DEFINITIONS)
+ _HDF5_remove_duplicates_from_beginning(HDF5_${_lang}_INCLUDE_DIRS)
+ _HDF5_remove_duplicates_from_beginning(HDF5_${_lang}_LIBRARIES)
+ _HDF5_remove_duplicates_from_beginning(HDF5_${_lang}_HL_LIBRARIES)
else()
- set(_HDF5_NEED_TO_SEARCH True)
+ set(_HDF5_NEED_TO_SEARCH TRUE)
endif()
else()
- set(_HDF5_NEED_TO_SEARCH True)
+ set(_HDF5_NEED_TO_SEARCH TRUE)
endif()
endif()
- if(HDF5_${__lang}_VERSION)
+ if(HDF5_${_lang}_VERSION)
if(NOT HDF5_VERSION)
- set(HDF5_VERSION ${HDF5_${__lang}_VERSION})
- elseif(NOT HDF5_VERSION VERSION_EQUAL HDF5_${__lang}_VERSION)
- message(WARNING "HDF5 Version found for language ${__lang}, ${HDF5_${__lang}_VERSION} is different than previously found version ${HDF5_VERSION}")
+ set(HDF5_VERSION ${HDF5_${_lang}_VERSION})
+ elseif(NOT HDF5_VERSION VERSION_EQUAL HDF5_${_lang}_VERSION)
+ message(WARNING "HDF5 Version found for language ${_lang}, ${HDF5_${_lang}_VERSION} is different than previously found version ${HDF5_VERSION}")
endif()
endif()
- if(DEFINED HDF5_${__lang}_IS_PARALLEL)
+ if(DEFINED HDF5_${_lang}_IS_PARALLEL)
if(NOT DEFINED HDF5_IS_PARALLEL)
- set(HDF5_IS_PARALLEL ${HDF5_${__lang}_IS_PARALLEL})
- elseif(NOT HDF5_IS_PARALLEL AND HDF5_${__lang}_IS_PARALLEL)
- message(WARNING "HDF5 found for language ${__lang} is parallel but previously found language is not parallel.")
- elseif(HDF5_IS_PARALLEL AND NOT HDF5_${__lang}_IS_PARALLEL)
- message(WARNING "HDF5 found for language ${__lang} is not parallel but previously found language is parallel.")
+ set(HDF5_IS_PARALLEL ${HDF5_${_lang}_IS_PARALLEL})
+ elseif(NOT HDF5_IS_PARALLEL AND HDF5_${_lang}_IS_PARALLEL)
+ message(WARNING "HDF5 found for language ${_lang} is parallel but previously found language is not parallel.")
+ elseif(HDF5_IS_PARALLEL AND NOT HDF5_${_lang}_IS_PARALLEL)
+ message(WARNING "HDF5 found for language ${_lang} is not parallel but previously found language is parallel.")
endif()
endif()
endforeach()
+ unset(_lib)
else()
- set(_HDF5_NEED_TO_SEARCH True)
+ set(_HDF5_NEED_TO_SEARCH TRUE)
endif()
if(NOT HDF5_FOUND AND HDF5_COMPILER_NO_INTERROGATE)
# No arguments necessary, all languages can use the compiler wrappers
- set(HDF5_FOUND True)
+ set(HDF5_FOUND TRUE)
set(HDF5_METHOD "Included by compiler wrappers")
set(HDF5_REQUIRED_VARS HDF5_METHOD)
elseif(NOT HDF5_FOUND AND NOT _HDF5_NEED_TO_SEARCH)
@@ -736,14 +744,14 @@ elseif(NOT HDF5_FOUND AND NOT _HDF5_NEED_TO_SEARCH)
set(HDF5_INCLUDE_DIRS)
set(HDF5_LIBRARIES)
set(HDF5_HL_LIBRARIES)
- foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS)
- if(HDF5_${__lang}_FOUND)
- if(NOT HDF5_${__lang}_COMPILER_NO_INTERROGATE)
- list(APPEND HDF5_DEFINITIONS ${HDF5_${__lang}_DEFINITIONS})
- list(APPEND HDF5_INCLUDE_DIRS ${HDF5_${__lang}_INCLUDE_DIRS})
- list(APPEND HDF5_LIBRARIES ${HDF5_${__lang}_LIBRARIES})
- if(FIND_HL)
- list(APPEND HDF5_HL_LIBRARIES ${HDF5_${__lang}_HL_LIBRARIES})
+ foreach(_lang IN LISTS HDF5_LANGUAGE_BINDINGS)
+ if(HDF5_${_lang}_FOUND)
+ if(NOT HDF5_${_lang}_COMPILER_NO_INTERROGATE)
+ list(APPEND HDF5_DEFINITIONS ${HDF5_${_lang}_DEFINITIONS})
+ list(APPEND HDF5_INCLUDE_DIRS ${HDF5_${_lang}_INCLUDE_DIRS})
+ list(APPEND HDF5_LIBRARIES ${HDF5_${_lang}_LIBRARIES})
+ if(HDF5_FIND_HL)
+ list(APPEND HDF5_HL_LIBRARIES ${HDF5_${_lang}_HL_LIBRARIES})
endif()
endif()
endif()
@@ -752,9 +760,9 @@ elseif(NOT HDF5_FOUND AND NOT _HDF5_NEED_TO_SEARCH)
_HDF5_remove_duplicates_from_beginning(HDF5_INCLUDE_DIRS)
_HDF5_remove_duplicates_from_beginning(HDF5_LIBRARIES)
_HDF5_remove_duplicates_from_beginning(HDF5_HL_LIBRARIES)
- set(HDF5_FOUND True)
+ set(HDF5_FOUND TRUE)
set(HDF5_REQUIRED_VARS HDF5_LIBRARIES)
- if(FIND_HL)
+ if(HDF5_FIND_HL)
list(APPEND HDF5_REQUIRED_VARS HDF5_HL_LIBRARIES)
endif()
endif()
@@ -789,29 +797,29 @@ if( NOT HDF5_FOUND )
set(_inc_suffixes include/shared)
endif()
- foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS)
+ foreach(_lang IN LISTS HDF5_LANGUAGE_BINDINGS)
# find the HDF5 include directories
- if("${__lang}" STREQUAL "Fortran")
+ if("${_lang}" STREQUAL "Fortran")
set(HDF5_INCLUDE_FILENAME hdf5.mod HDF5.mod)
- elseif("${__lang}" STREQUAL "CXX")
+ elseif("${_lang}" STREQUAL "CXX")
set(HDF5_INCLUDE_FILENAME H5Cpp.h)
else()
set(HDF5_INCLUDE_FILENAME hdf5.h)
endif()
- find_path(HDF5_${__lang}_INCLUDE_DIR ${HDF5_INCLUDE_FILENAME}
+ find_path(HDF5_${_lang}_INCLUDE_DIR ${HDF5_INCLUDE_FILENAME}
HINTS ${HDF5_ROOT}
PATHS $ENV{HOME}/.local/include
PATH_SUFFIXES include Include ${_inc_suffixes} ${_lib_suffixes}
${_HDF5_SEARCH_OPTS}
)
- mark_as_advanced(HDF5_${__lang}_INCLUDE_DIR)
+ mark_as_advanced(HDF5_${_lang}_INCLUDE_DIR)
# set the _DIRS variable as this is what the user will normally use
- set(HDF5_${__lang}_INCLUDE_DIRS ${HDF5_${__lang}_INCLUDE_DIR})
- list(APPEND HDF5_INCLUDE_DIRS ${HDF5_${__lang}_INCLUDE_DIR})
+ set(HDF5_${_lang}_INCLUDE_DIRS ${HDF5_${_lang}_INCLUDE_DIR})
+ list(APPEND HDF5_INCLUDE_DIRS ${HDF5_${_lang}_INCLUDE_DIR})
# find the HDF5 libraries
- foreach(LIB IN LISTS HDF5_${__lang}_LIBRARY_NAMES)
+ foreach(LIB IN LISTS HDF5_${_lang}_LIBRARY_NAMES)
if(HDF5_USE_STATIC_LIBRARIES)
# According to bug 1643 on the CMake bug tracker, this is the
# preferred method for searching for a static library.
@@ -841,18 +849,18 @@ if( NOT HDF5_FOUND )
)
select_library_configurations( HDF5_${LIB} )
- list(APPEND HDF5_${__lang}_LIBRARIES ${HDF5_${LIB}_LIBRARY})
+ list(APPEND HDF5_${_lang}_LIBRARIES ${HDF5_${LIB}_LIBRARY})
endforeach()
- if(HDF5_${__lang}_LIBRARIES)
- set(HDF5_${__lang}_FOUND True)
+ if(HDF5_${_lang}_LIBRARIES)
+ set(HDF5_${_lang}_FOUND TRUE)
endif()
# Append the libraries for this language binding to the list of all
# required libraries.
- list(APPEND HDF5_LIBRARIES ${HDF5_${__lang}_LIBRARIES})
+ list(APPEND HDF5_LIBRARIES ${HDF5_${_lang}_LIBRARIES})
- if(FIND_HL)
- foreach(LIB IN LISTS HDF5_${__lang}_HL_LIBRARY_NAMES)
+ if(HDF5_FIND_HL)
+ foreach(LIB IN LISTS HDF5_${_lang}_HL_LIBRARY_NAMES)
if(HDF5_USE_STATIC_LIBRARIES)
# According to bug 1643 on the CMake bug tracker, this is the
# preferred method for searching for a static library.
@@ -879,16 +887,16 @@ if( NOT HDF5_FOUND )
)
select_library_configurations( HDF5_${LIB} )
- list(APPEND HDF5_${__lang}_HL_LIBRARIES ${HDF5_${LIB}_LIBRARY})
+ list(APPEND HDF5_${_lang}_HL_LIBRARIES ${HDF5_${LIB}_LIBRARY})
endforeach()
# Append the libraries for this language binding to the list of all
# required libraries.
- list(APPEND HDF5_HL_LIBRARIES ${HDF5_${__lang}_HL_LIBRARIES})
+ list(APPEND HDF5_HL_LIBRARIES ${HDF5_${_lang}_HL_LIBRARIES})
endif()
endforeach()
- if(FIND_HL AND HDF5_HL_LIBRARIES)
- set(HDF5_HL_FOUND True)
+ if(HDF5_FIND_HL AND HDF5_HL_LIBRARIES)
+ set(HDF5_HL_FOUND TRUE)
endif()
_HDF5_remove_duplicates_from_beginning(HDF5_DEFINITIONS)
@@ -925,12 +933,14 @@ if( NOT HDF5_FOUND )
endif()
endforeach()
endforeach()
+ unset(_hdr)
+ unset(_dir)
set( HDF5_IS_PARALLEL ${HDF5_IS_PARALLEL} CACHE BOOL
"HDF5 library compiled with parallel IO support" )
mark_as_advanced( HDF5_IS_PARALLEL )
set(HDF5_REQUIRED_VARS HDF5_LIBRARIES HDF5_INCLUDE_DIRS)
- if(FIND_HL)
+ if(HDF5_FIND_HL)
list(APPEND HDF5_REQUIRED_VARS HDF5_HL_LIBRARIES)
endif()
endif()
@@ -968,13 +978,15 @@ if (HDF5_FIND_DEBUG)
message(STATUS "HDF5_INCLUDE_DIRS: ${HDF5_INCLUDE_DIRS}")
message(STATUS "HDF5_LIBRARIES: ${HDF5_LIBRARIES}")
message(STATUS "HDF5_HL_LIBRARIES: ${HDF5_HL_LIBRARIES}")
- foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS)
- message(STATUS "HDF5_${__lang}_DEFINITIONS: ${HDF5_${__lang}_DEFINITIONS}")
- message(STATUS "HDF5_${__lang}_INCLUDE_DIR: ${HDF5_${__lang}_INCLUDE_DIR}")
- message(STATUS "HDF5_${__lang}_INCLUDE_DIRS: ${HDF5_${__lang}_INCLUDE_DIRS}")
- message(STATUS "HDF5_${__lang}_LIBRARY: ${HDF5_${__lang}_LIBRARY}")
- message(STATUS "HDF5_${__lang}_LIBRARIES: ${HDF5_${__lang}_LIBRARIES}")
- message(STATUS "HDF5_${__lang}_HL_LIBRARY: ${HDF5_${__lang}_HL_LIBRARY}")
- message(STATUS "HDF5_${__lang}_HL_LIBRARIES: ${HDF5_${__lang}_HL_LIBRARIES}")
+ foreach(_lang IN LISTS HDF5_LANGUAGE_BINDINGS)
+ message(STATUS "HDF5_${_lang}_DEFINITIONS: ${HDF5_${_lang}_DEFINITIONS}")
+ message(STATUS "HDF5_${_lang}_INCLUDE_DIR: ${HDF5_${_lang}_INCLUDE_DIR}")
+ message(STATUS "HDF5_${_lang}_INCLUDE_DIRS: ${HDF5_${_lang}_INCLUDE_DIRS}")
+ message(STATUS "HDF5_${_lang}_LIBRARY: ${HDF5_${_lang}_LIBRARY}")
+ message(STATUS "HDF5_${_lang}_LIBRARIES: ${HDF5_${_lang}_LIBRARIES}")
+ message(STATUS "HDF5_${_lang}_HL_LIBRARY: ${HDF5_${_lang}_HL_LIBRARY}")
+ message(STATUS "HDF5_${_lang}_HL_LIBRARIES: ${HDF5_${_lang}_HL_LIBRARIES}")
endforeach()
endif()
+unset(_lang)
+unset(_HDF5_NEED_TO_SEARCH)
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index af713d6..a813ab5 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -22,6 +22,27 @@ This module defines the following :prop_tgt:`IMPORTED` targets:
The OpenSSL ``ssl`` library, if found.
``OpenSSL::Crypto``
The OpenSSL ``crypto`` library, if found.
+``OpenSSL::applink``
+ The OpenSSL ``applink`` components that might be need to be compiled into
+ projects under MSVC. This target is available only if found OpenSSL version
+ is not less than 0.9.8. By linking this target the above OpenSSL targets can
+ be linked even if the project has different MSVC runtime configurations with
+ the above OpenSSL targets. This target has no effect on plaforms other than
+ MSVC.
+
+NOTE: Due to how ``INTERFACE_SOURCES`` are consumed by the consuming target,
+unless you certainly know what you are doing, it is always prefered to link
+``OpenSSL::applink`` target as ``PRIVATE`` and to make sure that this target is
+linked at most once for the whole dependency graph of any library or
+executable:
+
+.. code-block:: cmake
+
+ target_link_libraries(myTarget PRIVATE OpenSSL::applink)
+
+Otherwise you would probably encounter unexpected random problems when building
+and linking, as both the ISO C and the ISO C++ standard claims almost nothing
+about what a link process should be.
Result Variables
^^^^^^^^^^^^^^^^
@@ -45,6 +66,10 @@ This module will set the following variables in your project:
All OpenSSL libraries and their dependencies.
``OPENSSL_VERSION``
This is set to ``$major.$minor.$revision$patch`` (e.g. ``0.9.8s``).
+``OPENSSL_APPLINK_SOURCE``
+ The sources in the target ``OpenSSL::applink`` that is mentioned above. This
+ variable shall always be undefined if found openssl version is less than
+ 0.9.8 or if platform is not MSVC.
Hints
^^^^^
@@ -524,6 +549,28 @@ if(OPENSSL_FOUND)
endif()
_OpenSSL_target_add_dependencies(OpenSSL::SSL)
endif()
+
+ if("${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_FIX}" VERSION_GREATER_EQUAL "0.9.8")
+ if(MSVC)
+ if(EXISTS "${OPENSSL_INCLUDE_DIR}")
+ set(_OPENSSL_applink_paths PATHS ${OPENSSL_INCLUDE_DIR})
+ endif()
+ find_file(OPENSSL_APPLINK_SOURCE
+ NAMES
+ openssl/applink.c
+ ${_OPENSSL_applink_paths}
+ NO_DEFAULT_PATH)
+ if(OPENSSL_APPLINK_SOURCE)
+ set(_OPENSSL_applink_interface_srcs ${OPENSSL_APPLINK_SOURCE})
+ endif()
+ endif()
+ if(NOT TARGET OpenSSL::applink)
+ add_library(OpenSSL::applink INTERFACE IMPORTED)
+ set_property(TARGET OpenSSL::applink APPEND
+ PROPERTY INTERFACE_SOURCES
+ ${_OPENSSL_applink_interface_srcs})
+ endif()
+ endif()
endif()
# Restore the original find library ordering
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index 835811c..93827d8 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -412,6 +412,36 @@ function(_pkgconfig_extract_frameworks _prefix)
set(${_prefix}_LDFLAGS_OTHER "${ldflags}" PARENT_SCOPE)
endfunction()
+# pkg-config returns -isystem include directories in --cflags-only-other,
+# depending on the version and if there is a space between -isystem and
+# the actual path
+function(_pkgconfig_extract_isystem _prefix)
+ set(cflags "${${_prefix}_CFLAGS_OTHER}")
+ set(outflags "")
+ set(incdirs "${${_prefix}_INCLUDE_DIRS}")
+
+ set(next_is_isystem FALSE)
+ foreach (THING IN LISTS cflags)
+ # This may filter "-isystem -isystem". That would not work anyway,
+ # so let it happen.
+ if (THING STREQUAL "-isystem")
+ set(next_is_isystem TRUE)
+ continue()
+ endif ()
+ if (next_is_isystem)
+ set(next_is_isystem FALSE)
+ list(APPEND incdirs "${THING}")
+ elseif (THING MATCHES "^-isystem")
+ string(SUBSTRING "${THING}" 8 -1 THING)
+ list(APPEND incdirs "${THING}")
+ else ()
+ list(APPEND outflags "${THING}")
+ endif ()
+ endforeach ()
+ set(${_prefix}_CFLAGS_OTHER "${outflags}" PARENT_SCOPE)
+ set(${_prefix}_INCLUDE_DIRS "${incdirs}" PARENT_SCOPE)
+endfunction()
+
###
macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cmake_environment_path _imp_target _imp_target_global _prefix)
_pkgconfig_unset(${_prefix}_FOUND)
@@ -545,18 +575,22 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma
endforeach()
# set variables which are combined for multiple modules
- _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARIES "(^| )-l" --libs-only-l )
- _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARY_DIRS "(^| )-L" --libs-only-L )
- _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS "" --libs )
- _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS_OTHER "" --libs-only-other )
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARIES "(^| )-l" --libs-only-l )
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARY_DIRS "(^| )-L" --libs-only-L )
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS "" --libs )
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS_OTHER "" --libs-only-other )
if (APPLE AND "-framework" IN_LIST ${_prefix}_LDFLAGS_OTHER)
_pkgconfig_extract_frameworks("${_prefix}")
endif()
- _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" INCLUDE_DIRS "(^| )-I" --cflags-only-I )
- _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags )
- _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other )
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" INCLUDE_DIRS "(^| )(-I|-isystem ?)" --cflags-only-I )
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags )
+ _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other )
+
+ if (${_prefix}_CFLAGS_OTHER MATCHES "-isystem")
+ _pkgconfig_extract_isystem("${_prefix}")
+ endif ()
_pkg_recalculate("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target} ${_imp_target_global})
endif()
diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake
index 93f77a8..01b82c4 100644
--- a/Modules/FindPython.cmake
+++ b/Modules/FindPython.cmake
@@ -85,6 +85,7 @@ This module will set the following variables in your project
* Anaconda
* Canopy
* IronPython
+ * PyPy
``Python_STDLIB``
Standard platform independent installation directory.
@@ -125,6 +126,8 @@ This module will set the following variables in your project
``Python_COMPILER_ID``
A short string unique to the compiler. Possible values include:
* IronPython
+``Python_DOTNET_LAUNCHER``
+ The ``.Net`` interpreter. Only used by ``IronPython`` implementation.
``Python_Development_FOUND``
System has the Python development artifacts.
``Python_Development.Module_FOUND``
@@ -147,6 +150,8 @@ This module will set the following variables in your project
Python minor version.
``Python_VERSION_PATCH``
Python patch version.
+``Python_PyPy_VERSION``
+ Python PyPy version.
``Python_NumPy_FOUND``
System has the NumPy.
``Python_NumPy_INCLUDE_DIRS``
@@ -281,8 +286,14 @@ Hints
* ``IronPython``: This implementation use the ``CSharp`` language for
``.NET Framework`` on top of the `Dynamic Language Runtime` (``DLR``).
See `IronPython <http://ironpython.net>`_.
+ * ``PyPy``: This implementation use ``RPython`` language and
+ ``RPython translation toolchain`` to produce the python interpreter.
+ See `PyPy <https://www.pypy.org>`_.
- The default value is the list: ``CPython``, ``IronPython``.
+ The default value is:
+
+ * Windows platform: ``CPython``, ``IronPython``
+ * Other platforms: ``CPython``
.. note::
@@ -292,6 +303,12 @@ Hints
``Python_FIND_STRATEGY=LOCATION``, each location will be search first for
``IronPython`` and second for ``CPython``.
+ .. note::
+
+ When ``IronPython`` is specified, on platforms other than ``Windows``, the
+ ``.Net`` interpreter (i.e. ``mono`` command) is expected to be available
+ through the ``PATH`` variable.
+
Artifacts Specification
^^^^^^^^^^^^^^^^^^^^^^^
@@ -304,6 +321,9 @@ setting the following variables:
``Python_COMPILER``
The path to the compiler.
+``Python_DOTNET_LAUNCHER``
+ The ``.Net`` interpreter. Only used by ``IronPython`` implementation.
+
``Python_LIBRARY``
The path to the library. It will be used to compute the
variables ``Python_LIBRARIES``, ``Python_LIBRAY_DIRS`` and
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index 733faa8..1be0625 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -93,7 +93,6 @@ endmacro()
macro (_PYTHON_FIND_FRAMEWORKS)
- set (${_PYTHON_PREFIX}_FRAMEWORKS)
if (CMAKE_HOST_APPLE OR APPLE)
file(TO_CMAKE_PATH "$ENV{CMAKE_FRAMEWORK_PATH}" _pff_CMAKE_FRAMEWORK_PATH)
set (_pff_frameworks ${CMAKE_FRAMEWORK_PATH}
@@ -102,28 +101,61 @@ macro (_PYTHON_FIND_FRAMEWORKS)
/usr/local/Frameworks
${CMAKE_SYSTEM_FRAMEWORK_PATH})
list (REMOVE_DUPLICATES _pff_frameworks)
- foreach (_pff_framework IN LISTS _pff_frameworks)
- if (EXISTS ${_pff_framework}/Python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}.framework)
- list (APPEND ${_PYTHON_PREFIX}_FRAMEWORKS ${_pff_framework}/Python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}.framework)
- endif()
- if (EXISTS ${_pff_framework}/Python.framework)
- list (APPEND ${_PYTHON_PREFIX}_FRAMEWORKS ${_pff_framework}/Python.framework)
+ foreach (_pff_implementation IN LISTS _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS)
+ unset (_${_PYTHON_PREFIX}_${_pff_implementation}_FRAMEWORKS)
+ if (_pff_implementation STREQUAL "CPython")
+ foreach (_pff_framework IN LISTS _pff_frameworks)
+ if (EXISTS ${_pff_framework}/Python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}.framework)
+ list (APPEND _${_PYTHON_PREFIX}_${_pff_implementation}_FRAMEWORKS ${_pff_framework}/Python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}.framework)
+ endif()
+ if (EXISTS ${_pff_framework}/Python.framework)
+ list (APPEND _${_PYTHON_PREFIX}_${_pff_implementation}_FRAMEWORKS ${_pff_framework}/Python.framework)
+ endif()
+ endforeach()
+ elseif (_pff_implementation STREQUAL "IronPython")
+ foreach (_pff_framework IN LISTS _pff_frameworks)
+ if (EXISTS ${_pff_framework}/IronPython.framework)
+ list (APPEND _${_PYTHON_PREFIX}_${_pff_implementation}_FRAMEWORKS ${_pff_framework}/IronPython.framework)
+ endif()
+ endforeach()
endif()
endforeach()
+ unset (_pff_implementation)
unset (_pff_frameworks)
unset (_pff_framework)
endif()
endmacro()
function (_PYTHON_GET_FRAMEWORKS _PYTHON_PGF_FRAMEWORK_PATHS)
- cmake_parse_arguments (PARSE_ARGV 1 _PGF "" "" "VERSION")
+ cmake_parse_arguments (PARSE_ARGV 1 _PGF "" "" "IMPLEMENTATIONS;VERSION")
+
+ if (NOT _PGF_IMPLEMENTATIONS)
+ set (_PGF_IMPLEMENTATIONS ${_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS})
+ endif()
set (framework_paths)
- foreach (version IN LISTS _PGF_VERSION)
- foreach (framework IN LISTS ${_PYTHON_PREFIX}_FRAMEWORKS)
- list (APPEND framework_paths "${framework}/Versions/${version}")
- endforeach()
+ foreach (implementation IN LISTS _PGF_IMPLEMENTATIONS)
+ if (implementation STREQUAL "CPython")
+ foreach (version IN LISTS _PGF_VERSION)
+ foreach (framework IN LISTS _${_PYTHON_PREFIX}_${implementation}_FRAMEWORKS)
+ if (EXISTS "${framework}/Versions/${version}")
+ list (APPEND framework_paths "${framework}/Versions/${version}")
+ endif()
+ endforeach()
+ endforeach()
+ elseif (implementation STREQUAL "IronPython")
+ foreach (version IN LISTS _PGF_VERSION)
+ foreach (framework IN LISTS _${_PYTHON_PREFIX}_${implementation}_FRAMEWORKS)
+ # pick-up all available versions
+ file (GLOB versions LIST_DIRECTORIES true RELATIVE "${framework}/Versions/"
+ "${framework}/Versions/${version}*")
+ list (SORT versions ORDER DESCENDING)
+ list (TRANSFORM versions PREPEND "${framework}/Versions/")
+ list (APPEND framework_paths ${versions})
+ endforeach()
+ endforeach()
+ endif()
endforeach()
set (${_PYTHON_PGF_FRAMEWORK_PATHS} ${framework_paths} PARENT_SCOPE)
@@ -144,8 +176,18 @@ function (_PYTHON_GET_REGISTRIES _PYTHON_PGR_REGISTRY_PATHS)
string (REPLACE "." "" version_no_dots ${version})
list (APPEND registries
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${version}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
- [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${version}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath]
- [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${version}\\InstallPath]
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${version}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath])
+ if (version VERSION_GREATER_EQUAL "3.5")
+ get_filename_component (arch "[HKEY_CURRENT_USER\\Software\\Python\\PythonCore\\${version};SysArchitecture]" NAME)
+ if (arch MATCHES "(${_${_PYTHON_PREFIX}_ARCH}|${_${_PYTHON_PREFIX}_ARCH2})bit")
+ list (APPEND registries
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${version}\\InstallPath])
+ endif()
+ else()
+ list (APPEND registries
+ [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${version}\\InstallPath])
+ endif()
+ list (APPEND registries
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${version_no_dots}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${version_no_dots}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${version}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]
@@ -209,7 +251,11 @@ function (_PYTHON_GET_ABIFLAGS _PGABIFLAGS)
endfunction()
function (_PYTHON_GET_PATH_SUFFIXES _PYTHON_PGPS_PATH_SUFFIXES)
- cmake_parse_arguments (PARSE_ARGV 1 _PGPS "EXECUTABLE;LIBRARY;INCLUDE" "" "VERSION")
+ cmake_parse_arguments (PARSE_ARGV 1 _PGPS "INTERPRETER;COMPILER;LIBRARY;INCLUDE" "" "IMPLEMENTATIONS;VERSION")
+
+ if (NOT _PGPS_IMPLEMENTATIONS)
+ set (_PGPS_IMPLEMENTATIONS ${_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS})
+ endif()
if (DEFINED _${_PYTHON_PREFIX}_ABIFLAGS)
set (abi "${_${_PYTHON_PREFIX}_ABIFLAGS}")
@@ -219,9 +265,9 @@ function (_PYTHON_GET_PATH_SUFFIXES _PYTHON_PGPS_PATH_SUFFIXES)
set (path_suffixes)
- foreach (implementation IN LISTS _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS)
+ foreach (implementation IN LISTS _PGPS_IMPLEMENTATIONS)
if (implementation STREQUAL "CPython")
- if (_PGPS_EXECUTABLE)
+ if (_PGPS_INTERPRETER)
list (APPEND path_suffixes bin Scripts)
else()
foreach (version IN LISTS _PGPS_VERSION)
@@ -260,9 +306,20 @@ function (_PYTHON_GET_PATH_SUFFIXES _PYTHON_PGPS_PATH_SUFFIXES)
endforeach()
endif()
elseif (implementation STREQUAL "IronPython")
- if (_PGPS_EXECUTABLE)
+ if (_PGPS_INTERPRETER OR _PGPS_COMPILER)
+ foreach (version IN LISTS _PGPS_VERSION)
+ list (APPEND path_suffixes "share/ironpython${version}")
+ endforeach()
list (APPEND path_suffixes ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES})
endif()
+ elseif (implementation STREQUAL "PyPy")
+ if (_PGPS_INTERPRETER)
+ list (APPEND path_suffixes ${_${_PYTHON_PREFIX}_PYPY_EXECUTABLE_PATH_SUFFIXES})
+ elseif (_PGPS_LIBRARY)
+ list (APPEND path_suffixes ${_${_PYTHON_PREFIX}_PYPY_LIBRARY_PATH_SUFFIXES})
+ elseif (_PGPS_INCLUDE)
+ list (APPEND path_suffixes ${_${_PYTHON_PREFIX}_PYPY_INCLUDE_PATH_SUFFIXES})
+ endif()
endif()
endforeach()
list (REMOVE_DUPLICATES path_suffixes)
@@ -271,11 +328,15 @@ function (_PYTHON_GET_PATH_SUFFIXES _PYTHON_PGPS_PATH_SUFFIXES)
endfunction()
function (_PYTHON_GET_NAMES _PYTHON_PGN_NAMES)
- cmake_parse_arguments (PARSE_ARGV 1 _PGN "POSIX;EXECUTABLE;CONFIG;LIBRARY;WIN32;DEBUG" "" "VERSION")
+ cmake_parse_arguments (PARSE_ARGV 1 _PGN "POSIX;INTERPRETER;COMPILER;CONFIG;LIBRARY;WIN32;DEBUG" "" "IMPLEMENTATIONS;VERSION")
+
+ if (NOT _PGN_IMPLEMENTATIONS)
+ set (_PGN_IMPLEMENTATIONS ${_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS})
+ endif()
set (names)
- foreach (implementation IN LISTS _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS)
+ foreach (implementation IN LISTS _PGN_IMPLEMENTATIONS)
if (implementation STREQUAL "CPython")
foreach (version IN LISTS _PGN_VERSION)
if (_PGN_WIN32)
@@ -293,7 +354,7 @@ function (_PYTHON_GET_NAMES _PYTHON_PGN_NAMES)
if (DEFINED _${_PYTHON_PREFIX}_ABIFLAGS)
set (abi "${_${_PYTHON_PREFIX}_ABIFLAGS}")
else()
- if (_PGN_EXECUTABLE OR _PGN_CONFIG)
+ if (_PGN_INTERPRETER OR _PGN_CONFIG)
set (abi "")
else()
set (abi "mu" "m" "u" "")
@@ -326,12 +387,37 @@ function (_PYTHON_GET_NAMES _PYTHON_PGN_NAMES)
endif()
endif()
endforeach()
- if (_PGN_EXECUTABLE)
+ if (_PGN_INTERPRETER)
list (APPEND names python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} python)
endif()
elseif (implementation STREQUAL "IronPython")
- if (_PGN_EXECUTABLE)
- list (APPEND names ${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES})
+ if (_PGN_INTERPRETER)
+ if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ # Do not use wrapper script on Linux because it is buggy: -c interpreter option cannot be used
+ foreach (version IN LISTS _PGN_VERSION)
+ list (APPEND names "ipy${version}")
+ endforeach()
+ endif()
+ list (APPEND names ${_${_PYTHON_PREFIX}_IRON_PYTHON_INTERPRETER_NAMES})
+ elseif (_PGN_COMPILER)
+ list (APPEND names ${_${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_NAMES})
+ endif()
+ elseif (implementation STREQUAL "PyPy")
+ if (_PGN_INTERPRETER)
+ list (APPEND names ${_${_PYTHON_PREFIX}_PYPY_NAMES})
+ elseif (_PGN_LIBRARY)
+ if (_PGN_WIN32)
+ foreach (version IN LISTS _PGN_VERSION)
+ string (REPLACE "." "" version_no_dots ${version})
+
+ set (name "python${version_no_dots}")
+ if (_PGN_DEBUG)
+ string (APPEND name "_d")
+ endif()
+ list (APPEND names "${name}")
+ endforeach()
+ endif()
+ list (APPEND names ${_${_PYTHON_PREFIX}_PYPY_LIB_NAMES})
endif()
endif()
endforeach()
@@ -375,7 +461,7 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
if (_${_PYTHON_PREFIX}_EXECUTABLE AND NOT CMAKE_CROSSCOMPILING)
if (NAME STREQUAL "PREFIX")
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.PREFIX,sysconfig.EXEC_PREFIX,sysconfig.BASE_EXEC_PREFIX]))\nexcept Exception:\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_config_var('base') or '', sysconfig.get_config_var('installed_base') or '']))"
+ execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.PREFIX,sysconfig.EXEC_PREFIX,sysconfig.BASE_EXEC_PREFIX]))\nexcept Exception:\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_config_var('base') or '', sysconfig.get_config_var('installed_base') or '']))"
RESULT_VARIABLE _result
OUTPUT_VARIABLE _values
ERROR_QUIET
@@ -391,7 +477,8 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
else()
set (_scheme "posix_prefix")
endif()
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_python_inc(plat_specific=True),sysconfig.get_python_inc(plat_specific=False)]))\nexcept Exception:\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_path('platinclude'),sysconfig.get_path('platinclude','${_scheme}'),sysconfig.get_path('include'),sysconfig.get_path('include','${_scheme}')]))"
+ execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
+ "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_python_inc(plat_specific=True),sysconfig.get_python_inc(plat_specific=False)]))\nexcept Exception:\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_path('platinclude'),sysconfig.get_path('platinclude','${_scheme}'),sysconfig.get_path('include'),sysconfig.get_path('include','${_scheme}')]))"
RESULT_VARIABLE _result
OUTPUT_VARIABLE _values
ERROR_QUIET
@@ -402,7 +489,8 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
list (REMOVE_DUPLICATES _values)
endif()
elseif (NAME STREQUAL "SOABI")
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_config_var('SOABI') or '',sysconfig.get_config_var('EXT_SUFFIX') or '']))\nexcept Exception:\n import sysconfig;sys.stdout.write(';'.join([sysconfig.get_config_var('SOABI') or '',sysconfig.get_config_var('EXT_SUFFIX') or '']))"
+ execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
+ "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_config_var('SOABI') or '',sysconfig.get_config_var('EXT_SUFFIX') or '']))\nexcept Exception:\n import sysconfig;sys.stdout.write(';'.join([sysconfig.get_config_var('SOABI') or '',sysconfig.get_config_var('EXT_SUFFIX') or '']))"
RESULT_VARIABLE _result
OUTPUT_VARIABLE _soabi
ERROR_QUIET
@@ -426,7 +514,8 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
if (NAME STREQUAL "CONFIGDIR")
set (config_flag "LIBPL")
endif()
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(sysconfig.get_config_var('${config_flag}'))\nexcept Exception:\n import sysconfig\n sys.stdout.write(sysconfig.get_config_var('${config_flag}'))"
+ execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
+ "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(sysconfig.get_config_var('${config_flag}'))\nexcept Exception:\n import sysconfig\n sys.stdout.write(sysconfig.get_config_var('${config_flag}'))"
RESULT_VARIABLE _result
OUTPUT_VARIABLE _values
ERROR_QUIET
@@ -484,8 +573,18 @@ function (_PYTHON_GET_VERSION)
set (${_PGV_PREFIX}VERSION_MINOR "${CMAKE_MATCH_2}" PARENT_SCOPE)
set (${_PGV_PREFIX}VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}" PARENT_SCOPE)
set (${_PGV_PREFIX}ABI "${CMAKE_MATCH_3}" PARENT_SCOPE)
+ elseif (_${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "pypy(3)?")
+ set (version "${CMAKE_MATCH_1}")
+ if (version EQUAL "3")
+ set (${_PGV_PREFIX}VERSION_MAJOR "3" PARENT_SCOPE)
+ set (${_PGV_PREFIX}VERSION "3" PARENT_SCOPE)
+ else()
+ set (${_PGV_PREFIX}VERSION_MAJOR "2" PARENT_SCOPE)
+ set (${_PGV_PREFIX}VERSION "2" PARENT_SCOPE)
endif()
+ set (${_PGV_PREFIX}ABI "" PARENT_SCOPE)
endif()
+ endif()
else()
if (_${_PYTHON_PREFIX}_INCLUDE_DIR)
# retrieve version from header file
@@ -530,6 +629,36 @@ function (_PYTHON_GET_VERSION)
endif()
endfunction()
+function (_PYTHON_GET_LAUNCHER _PYTHON_PGL_NAME)
+ cmake_parse_arguments (PARSE_ARGV 1 _PGL "INTERPRETER;COMPILER" "" "")
+
+ unset ({_PYTHON_PGL_NAME} PARENT_SCOPE)
+
+ if ((_PGL_INTERPRETER AND NOT _${_PYTHON_PREFIX}_EXECUTABLE)
+ OR (_PGL_COMPILER AND NOT _${_PYTHON_PREFIX}_COMPILER))
+ return()
+ endif()
+
+ if ("IronPython" IN_LIST _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS
+ AND NOT SYSTEM_NAME MATCHES "Windows|Linux")
+ if (_PGL_INTERPRETER)
+ get_filename_component (name "${_${_PYTHON_PREFIX}_EXECUTABLE}" NAME)
+ get_filename_component (ext "${_${_PYTHON_PREFIX}_EXECUTABLE}" LAST_EXT)
+ if (name IN_LIST _${_PYTHON_PREFIX}_IRON_PYTHON_INTERPRETER_NAMES
+ AND ext STREQUAL ".exe")
+ set (${_PYTHON_PGL_NAME} "${${_PYTHON_PREFIX}_DOTNET_LAUNCHER}" PARENT_SCOPE)
+ endif()
+ else()
+ get_filename_component (name "${_${_PYTHON_PREFIX}_COMPILER}" NAME)
+ get_filename_component (ext "${_${_PYTHON_PREFIX}_COMPILER}" LAST_EXT)
+ if (name IN_LIST _${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_NAMES
+ AND ext STREQUAL ".exe")
+ set (${_PYTHON_PGL_NAME} "${${_PYTHON_PREFIX}_DOTNET_LAUNCHER}" PARENT_SCOPE)
+ endif()
+ endif()
+ endif()
+endfunction()
+
function (_PYTHON_VALIDATE_INTERPRETER)
if (NOT _${_PYTHON_PREFIX}_EXECUTABLE)
@@ -550,9 +679,11 @@ function (_PYTHON_VALIDATE_INTERPRETER)
return()
endif()
+ _python_get_launcher (launcher INTERPRETER)
+
# validate ABI compatibility
if (DEFINED _${_PYTHON_PREFIX}_FIND_ABI)
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
+ execute_process (COMMAND ${launcher} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
"import sys; sys.stdout.write(sys.abiflags)"
RESULT_VARIABLE result
OUTPUT_VARIABLE abi
@@ -572,42 +703,52 @@ function (_PYTHON_VALIDATE_INTERPRETER)
get_filename_component (python_name "${_${_PYTHON_PREFIX}_EXECUTABLE}" NAME)
- if (expected_version AND NOT python_name STREQUAL "python${expected_version}${abi}${CMAKE_EXECUTABLE_SUFFIX}")
- # executable found must have a specific version
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
- "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:2]]))"
- RESULT_VARIABLE result
- OUTPUT_VARIABLE version
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- if (result)
- # interpreter is not usable
- set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Cannot use the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"" PARENT_SCOPE)
- set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
- else()
- if (_PVI_EXACT AND NOT version VERSION_EQUAL expected_version)
- # interpreter has wrong version
- set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Wrong version for the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"" PARENT_SCOPE)
+ if (expected_version)
+ if (NOT python_name STREQUAL "python${expected_version}${abi}${CMAKE_EXECUTABLE_SUFFIX}")
+ # compute number of components for version
+ string (REGEX REPLACE "[^.]" "" dots "${expected_version}")
+ # add one dot because there is one dot less than there are components
+ string (LENGTH "${dots}." count)
+ if (count GREATER 3)
+ set (count 3)
+ endif()
+
+ # executable found must have a specific version
+ execute_process (COMMAND ${launcher} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
+ "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:${count}]]))"
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE version
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if (result)
+ # interpreter is not usable
+ set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Cannot use the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"" PARENT_SCOPE)
set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
else()
- # check that version is OK
- string(REGEX REPLACE "^([0-9]+)\\..*$" "\\1" major_version "${version}")
- string(REGEX REPLACE "^([0-9]+)\\.?.*$" "\\1" expected_major_version "${expected_version}")
- if (NOT major_version VERSION_EQUAL expected_major_version
- OR NOT version VERSION_GREATER_EQUAL expected_version)
+ if (_PVI_EXACT AND NOT version VERSION_EQUAL expected_version)
+ # interpreter has wrong version
set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Wrong version for the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"" PARENT_SCOPE)
set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
+ else()
+ # check that version is OK
+ string(REGEX REPLACE "^([0-9]+)\\.?.*$" "\\1" major_version "${version}")
+ string(REGEX REPLACE "^([0-9]+)\\.?.*$" "\\1" expected_major_version "${expected_version}")
+ if (NOT major_version VERSION_EQUAL expected_major_version
+ OR NOT version VERSION_GREATER_EQUAL expected_version)
+ set (_${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE "Wrong version for the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"" PARENT_SCOPE)
+ set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
+ endif()
endif()
endif()
- endif()
- if (NOT _${_PYTHON_PREFIX}_EXECUTABLE)
- return()
+ if (NOT _${_PYTHON_PREFIX}_EXECUTABLE)
+ return()
+ endif()
endif()
else()
if (NOT python_name STREQUAL "python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}${CMAKE_EXECUTABLE_SUFFIX}")
# executable found do not have version in name
# ensure major version is OK
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
+ execute_process (COMMAND ${launcher} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
"import sys; sys.stdout.write(str(sys.version_info[0]))"
RESULT_VARIABLE result
OUTPUT_VARIABLE version
@@ -630,7 +771,7 @@ function (_PYTHON_VALIDATE_INTERPRETER)
OR "Development.Embed" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
AND NOT CMAKE_CROSSCOMPILING)
# In this case, interpreter must have same architecture as environment
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
+ execute_process (COMMAND ${launcher} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
"import sys, struct; sys.stdout.write(str(struct.calcsize(\"P\")))"
RESULT_VARIABLE result
OUTPUT_VARIABLE size
@@ -672,20 +813,33 @@ function (_PYTHON_VALIDATE_COMPILER)
return()
endif()
+ _python_get_launcher (launcher COMPILER)
+
# retrieve python environment version from compiler
set (working_dir "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PythonCompilerVersion.dir")
if (major_version)
# check only major version
file (WRITE "${working_dir}/version.py" "import sys; sys.stdout.write(str(sys.version_info[0]))")
else()
- file (WRITE "${working_dir}/version.py" "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:2]]))\n")
- endif()
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_COMPILER}" /target:exe /embed "${working_dir}/version.py"
+ # compute number of components for version
+ string (REGEX REPLACE "[^.]" "" dots "${expected_version}")
+ # add one dot because there is one dot less than there are components
+ string (LENGTH "${dots}." count)
+ if (count GREATER 3)
+ set (count 3)
+ endif()
+ file (WRITE "${working_dir}/version.py" "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:${count}]]))\n")
+ endif()
+ execute_process (COMMAND ${launcher} "${_${_PYTHON_PREFIX}_COMPILER}"
+ ${_${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_ARCH_FLAGS}
+ /target:exe /embed "${working_dir}/version.py"
WORKING_DIRECTORY "${working_dir}"
OUTPUT_QUIET
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
- execute_process (COMMAND "${working_dir}/version"
+ get_filename_component (ir_dir "${_${_PYTHON_PREFIX}_COMPILER}" DIRECTORY)
+ execute_process (COMMAND "${CMAKE_COMMAND}" -E env "MONO_PATH=${ir_dir}"
+ ${${_PYTHON_PREFIX}_DOTNET_LAUNCHER} "${working_dir}/version.exe"
WORKING_DIRECTORY "${working_dir}"
RESULT_VARIABLE result
OUTPUT_VARIABLE version
@@ -737,7 +891,9 @@ function (_PYTHON_VALIDATE_LIBRARY)
set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_RELEASE PROPERTY VALUE "${_PYTHON_PREFIX}_LIBRARY_RELEASE-NOTFOUND")
else()
if (expected_version)
- if ((_PVL_EXACT AND NOT lib_VERSION VERSION_EQUAL expected_version) OR (lib_VERSION VERSION_LESS expected_version))
+ # library have only major.minor information
+ string (REGEX MATCH "[0-9](\\.[0-9]+)?" version "${expected_version}")
+ if ((_PVL_EXACT AND NOT lib_VERSION VERSION_EQUAL version) OR (lib_VERSION VERSION_LESS version))
# library has wrong version
set (_${_PYTHON_PREFIX}_Development_REASON_FAILURE "Wrong version for the library \"${_${_PYTHON_PREFIX}_LIBRARY_RELEASE}\"" PARENT_SCOPE)
set_property (CACHE _${_PYTHON_PREFIX}_LIBRARY_RELEASE PROPERTY VALUE "${_PYTHON_PREFIX}_LIBRARY_RELEASE-NOTFOUND")
@@ -897,20 +1053,20 @@ endif()
set (_${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS ${_${_PYTHON_PREFIX}_FIND_DEVELOPMENT_MODULE_ARTIFACTS} ${_${_PYTHON_PREFIX}_FIND_DEVELOPMENT_EMBED_ARTIFACTS})
list (REMOVE_DUPLICATES _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS)
-unset (_${_PYTHON_PREFIX}_FIND_VERSIONS)
-
# Set versions to search
## default: search any version
set (_${_PYTHON_PREFIX}_FIND_VERSIONS ${_${_PYTHON_PREFIX}_VERSIONS})
+unset (_${_PYTHON_PREFIX}_FIND_VERSION_EXACT)
-if (${_PYTHON_PREFIX}_FIND_VERSION_COUNT GREATER "1")
+if (${_PYTHON_PREFIX}_FIND_VERSION_COUNT)
if (${_PYTHON_PREFIX}_FIND_VERSION_EXACT)
+ set (_${_PYTHON_PREFIX}_FIND_VERSION_EXACT "EXACT")
set (_${_PYTHON_PREFIX}_FIND_VERSIONS ${${_PYTHON_PREFIX}_FIND_VERSION_MAJOR}.${${_PYTHON_PREFIX}_FIND_VERSION_MINOR})
else()
unset (_${_PYTHON_PREFIX}_FIND_VERSIONS)
# add all compatible versions
foreach (_${_PYTHON_PREFIX}_VERSION IN LISTS _${_PYTHON_PREFIX}_VERSIONS)
- if (_${_PYTHON_PREFIX}_VERSION VERSION_GREATER_EQUAL ${_PYTHON_PREFIX}_FIND_VERSION)
+ if (_${_PYTHON_PREFIX}_VERSION VERSION_GREATER_EQUAL "${${_PYTHON_PREFIX}_FIND_VERSION_MAJOR}.${${_PYTHON_PREFIX}_FIND_VERSION_MINOR}")
list (APPEND _${_PYTHON_PREFIX}_FIND_VERSIONS ${_${_PYTHON_PREFIX}_VERSION})
endif()
endforeach()
@@ -967,28 +1123,63 @@ else()
endif()
# IronPython support
+unset (_${_PYTHON_PREFIX}_IRON_PYTHON_INTERPRETER_NAMES)
+unset (_${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_NAMES)
+unset (_${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_ARCH_FLAGS)
if (CMAKE_SIZEOF_VOID_P)
- # In this case, search only for 64bit or 32bit
- math (EXPR _${_PYTHON_PREFIX}_ARCH "${CMAKE_SIZEOF_VOID_P} * 8")
- set (_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES ipy${_${_PYTHON_PREFIX}_ARCH} ipy)
+ if (_${_PYTHON_PREFIX}_ARCH EQUAL "32")
+ set (_${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_ARCH_FLAGS "/platform:x86")
+ else()
+ set (_${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_ARCH_FLAGS "/platform:x64")
+ endif()
+endif()
+if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ # Do not use wrapper script on Linux because it is buggy: -c interpreter option cannot be used
+ list (APPEND _${_PYTHON_PREFIX}_IRON_PYTHON_INTERPRETER_NAMES "ipy${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}" "ipy64" "ipy32" "ipy")
+ list (APPEND _${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_NAMES "ipyc")
+endif()
+list (APPEND _${_PYTHON_PREFIX}_IRON_PYTHON_INTERPRETER_NAMES "ipy.exe")
+list (APPEND _${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_NAMES "ipyc.exe")
+set (_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES net45 net40 bin)
+
+# PyPy support
+if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR EQUAL "3")
+ set (_${_PYTHON_PREFIX}_PYPY_NAMES pypy3)
+ set (_${_PYTHON_PREFIX}_PYPY_LIB_NAMES pypy3-c)
+ if (WIN32)
+ # special name for runtime part
+ list (APPEND _${_PYTHON_PREFIX}_PYPY_LIB_NAMES libpypy3-c)
+ endif()
+ set (_${_PYTHON_PREFIX}_PYPY_INCLUDE_PATH_SUFFIXES lib/pypy3)
else()
- # architecture unknown, search for natural interpreter
- set (_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES ipy)
+ set (_${_PYTHON_PREFIX}_PYPY_NAMES pypy)
+ set (_${_PYTHON_PREFIX}_PYPY_LIB_NAMES pypy-c)
+ if (WIN32)
+ # special name for runtime part
+ list (APPEND _${_PYTHON_PREFIX}_PYPY_LIB_NAMES libpypy-c)
+ endif()
+ set (_${_PYTHON_PREFIX}_PYPY_INCLUDE_PATH_SUFFIXES lib/pypy)
endif()
-set (_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES net45 net40)
+set (_${_PYTHON_PREFIX}_PYPY_EXECUTABLE_PATH_SUFFIXES bin)
+set (_${_PYTHON_PREFIX}_PYPY_LIBRARY_PATH_SUFFIXES lib libs bin)
+list (APPEND _${_PYTHON_PREFIX}_PYPY_INCLUDE_PATH_SUFFIXES include)
# Python Implementations handling
unset (_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS)
if (DEFINED ${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS)
foreach (_${_PYTHON_PREFIX}_IMPLEMENTATION IN LISTS ${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS)
- if (NOT _${_PYTHON_PREFIX}_IMPLEMENTATION MATCHES "^(CPython|IronPython)$")
- message (AUTHOR_WARNING "Find${_PYTHON_PREFIX}: ${_${_PYTHON_PREFIX}_IMPLEMENTATION}: invalid value for '${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS'. 'CPython' or 'IronPython' expected. Value will be ignored.")
+ if (NOT _${_PYTHON_PREFIX}_IMPLEMENTATION MATCHES "^(CPython|IronPython|PyPy)$")
+ message (AUTHOR_WARNING "Find${_PYTHON_PREFIX}: ${_${_PYTHON_PREFIX}_IMPLEMENTATION}: invalid value for '${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS'. 'CPython', 'IronPython' or 'PyPy' expected. Value will be ignored.")
else()
list (APPEND _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS ${_${_PYTHON_PREFIX}_IMPLEMENTATION})
endif()
endforeach()
else()
- set (_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS CPython IronPython)
+ if (WIN32)
+ set (_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS CPython IronPython)
+ else()
+ set (_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS CPython)
+ endif()
endif()
# compute list of names for header file
@@ -996,6 +1187,8 @@ unset (_${_PYTHON_PREFIX}_INCLUDE_NAMES)
foreach (_${_PYTHON_PREFIX}_IMPLEMENTATION IN LISTS _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS)
if (_${_PYTHON_PREFIX}_IMPLEMENTATION STREQUAL "CPython")
list (APPEND _${_PYTHON_PREFIX}_INCLUDE_NAMES "Python.h")
+ elseif (_${_PYTHON_PREFIX}_IMPLEMENTATION STREQUAL "PyPy")
+ list (APPEND _${_PYTHON_PREFIX}_INCLUDE_NAMES "PyPy.h")
endif()
endforeach()
@@ -1093,14 +1286,15 @@ function (_PYTHON_CHECK_DEVELOPMENT_SIGNATURE module)
endif()
string (MD5 signature "${signature}")
if (signature STREQUAL _${_PYTHON_PREFIX}_DEVELOPMENT_${id}_SIGNATURE)
- if (${_PYTHON_PREFIX}_FIND_VERSION_EXACT)
- set (exact EXACT)
- endif()
if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_${id}_ARTIFACTS)
- _python_validate_library (${${_PYTHON_PREFIX}_FIND_VERSION} ${exact} CHECK_EXISTS)
+ _python_validate_library (${${_PYTHON_PREFIX}_FIND_VERSION}
+ ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT}
+ CHECK_EXISTS)
endif()
if ("INCLUDE_DIR" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_${id}_ARTIFACTS)
- _python_validate_include_dir (${${_PYTHON_PREFIX}_FIND_VERSION} ${exact} CHECK_EXISTS)
+ _python_validate_include_dir (${${_PYTHON_PREFIX}_FIND_VERSION}
+ ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT}
+ CHECK_EXISTS)
endif()
else()
if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_${id}_ARTIFACTS)
@@ -1147,10 +1341,19 @@ unset (_${_PYTHON_PREFIX}_Development_REASON_FAILURE)
unset (_${_PYTHON_PREFIX}_NumPy_REASON_FAILURE)
+# preamble
+## For IronPython on platforms other than Windows, search for the .Net interpreter
+if ("IronPython" IN_LIST _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS
+ AND NOT WIN32)
+ find_program (${_PYTHON_PREFIX}_DOTNET_LAUNCHER
+ NAMES "mono")
+endif()
+
+
# first step, search for the interpreter
if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_PYTHON_PREFIX}_EXECUTABLE
- _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES)
+ _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES)
if (${_PYTHON_PREFIX}_FIND_REQUIRED_Interpreter)
list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_EXECUTABLE)
endif()
@@ -1186,8 +1389,8 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
if (_${_PYTHON_PREFIX}_FIND_STRATEGY STREQUAL "LOCATION")
# build all executable names
- _python_get_names (_${_PYTHON_PREFIX}_NAMES VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS} POSIX EXECUTABLE)
- _python_get_path_suffixes (_${_PYTHON_PREFIX}_PATH_SUFFIXES VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS} EXECUTABLE)
+ _python_get_names (_${_PYTHON_PREFIX}_NAMES VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS} POSIX INTERPRETER)
+ _python_get_path_suffixes (_${_PYTHON_PREFIX}_PATH_SUFFIXES VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS} INTERPRETER)
# Framework Paths
_python_get_frameworks (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS})
@@ -1208,7 +1411,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
- _python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION})
+ _python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION} ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
if (_${_PYTHON_PREFIX}_EXECUTABLE)
break()
endif()
@@ -1229,7 +1432,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
NO_CMAKE_ENVIRONMENT_PATH
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
- _python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION})
+ _python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION} ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
if (_${_PYTHON_PREFIX}_EXECUTABLE)
break()
endif()
@@ -1244,7 +1447,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
- _python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION})
+ _python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION} ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
if (_${_PYTHON_PREFIX}_EXECUTABLE)
break()
endif()
@@ -1258,7 +1461,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
- _python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION})
+ _python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION} ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
if (_${_PYTHON_PREFIX}_EXECUTABLE)
break()
endif()
@@ -1267,7 +1470,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
NAMES ${_${_PYTHON_PREFIX}_NAMES}
NAMES_PER_DIR
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES})
- _python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION})
+ _python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION} ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
if (_${_PYTHON_PREFIX}_EXECUTABLE)
break()
endif()
@@ -1280,7 +1483,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_DEFAULT_PATH)
- _python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION})
+ _python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION} ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
if (_${_PYTHON_PREFIX}_EXECUTABLE)
break()
endif()
@@ -1293,7 +1496,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
PATHS ${_${_PYTHON_PREFIX}_REGISTRY_PATHS}
PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_DEFAULT_PATH)
- _python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION})
+ _python_validate_interpreter (${${_PYTHON_PREFIX}_FIND_VERSION} ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
if (_${_PYTHON_PREFIX}_EXECUTABLE)
break()
endif()
@@ -1304,8 +1507,8 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
else()
# look-up for various versions and locations
foreach (_${_PYTHON_PREFIX}_VERSION IN LISTS _${_PYTHON_PREFIX}_FIND_VERSIONS)
- _python_get_names (_${_PYTHON_PREFIX}_NAMES VERSION ${_${_PYTHON_PREFIX}_VERSION} POSIX EXECUTABLE)
- _python_get_path_suffixes (_${_PYTHON_PREFIX}_PATH_SUFFIXES VERSION ${_${_PYTHON_PREFIX}_VERSION} EXECUTABLE)
+ _python_get_names (_${_PYTHON_PREFIX}_NAMES VERSION ${_${_PYTHON_PREFIX}_VERSION} POSIX INTERPRETER)
+ _python_get_path_suffixes (_${_PYTHON_PREFIX}_PATH_SUFFIXES VERSION ${_${_PYTHON_PREFIX}_VERSION} INTERPRETER)
_python_get_frameworks (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS VERSION ${_${_PYTHON_PREFIX}_VERSION})
_python_get_registries (_${_PYTHON_PREFIX}_REGISTRY_PATHS VERSION ${_${_PYTHON_PREFIX}_VERSION})
@@ -1381,7 +1584,8 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
# for version 3.*. So looking for names per dir will find, potentially,
# systematically 'python' (i.e. version 2) even if version 3 is searched.
find_program (_${_PYTHON_PREFIX}_EXECUTABLE
- NAMES ${_${_PYTHON_PREFIX}_NAMES})
+ NAMES ${_${_PYTHON_PREFIX}_NAMES}
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES})
_python_validate_interpreter (${_${_PYTHON_PREFIX}_VERSION} EXACT)
if (_${_PYTHON_PREFIX}_EXECUTABLE)
break()
@@ -1421,7 +1625,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
# For example, typical systems have 'python' for version 2.* and 'python3'
# for version 3.*. So looking for names per dir will find, potentially,
# systematically 'python' (i.e. version 2) even if version 3 is searched.
- _python_get_names (_${_PYTHON_PREFIX}_NAMES POSIX EXECUTABLE)
+ _python_get_names (_${_PYTHON_PREFIX}_NAMES POSIX INTERPRETER)
find_program (_${_PYTHON_PREFIX}_EXECUTABLE
NAMES ${_${_PYTHON_PREFIX}_NAMES})
_python_validate_interpreter ()
@@ -1430,10 +1634,11 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
endif()
set (${_PYTHON_PREFIX}_EXECUTABLE "${_${_PYTHON_PREFIX}_EXECUTABLE}")
+ _python_get_launcher (_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER INTERPRETER)
# retrieve exact version of executable found
if (_${_PYTHON_PREFIX}_EXECUTABLE)
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
+ execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
"import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:3]]))"
RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
OUTPUT_VARIABLE ${_PYTHON_PREFIX}_VERSION
@@ -1480,7 +1685,8 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
# Use interpreter version and ABI for future searches to ensure consistency
set (_${_PYTHON_PREFIX}_FIND_VERSIONS ${${_PYTHON_PREFIX}_VERSION_MAJOR}.${${_PYTHON_PREFIX}_VERSION_MINOR})
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys; sys.stdout.write(sys.abiflags)"
+ execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETR_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
+ "import sys; sys.stdout.write(sys.abiflags)"
RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
OUTPUT_VARIABLE _${_PYTHON_PREFIX}_ABIFLAGS
ERROR_QUIET
@@ -1500,8 +1706,8 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
if (NOT CMAKE_SIZEOF_VOID_P)
# determine interpreter architecture
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
- "import sys; print(sys.maxsize > 2**32)"
+ execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
+ "import sys; sys.stdout.write(str(sys.maxsize > 2**32))"
RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
OUTPUT_VARIABLE ${_PYTHON_PREFIX}_IS64BIT
ERROR_VARIABLE ${_PYTHON_PREFIX}_IS64BIT)
@@ -1517,7 +1723,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
endif()
# retrieve interpreter identity
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -V
+ execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -V
RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
OUTPUT_VARIABLE ${_PYTHON_PREFIX}_INTERPRETER_ID
ERROR_VARIABLE ${_PYTHON_PREFIX}_INTERPRETER_ID)
@@ -1526,11 +1732,15 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
set (${_PYTHON_PREFIX}_INTERPRETER_ID "Anaconda")
elseif (${_PYTHON_PREFIX}_INTERPRETER_ID MATCHES "Enthought")
set (${_PYTHON_PREFIX}_INTERPRETER_ID "Canopy")
+ elseif (${_PYTHON_PREFIX}_INTERPRETER_ID MATCHES "PyPy ([0-9.]+)")
+ set (${_PYTHON_PREFIX}_INTERPRETER_ID "PyPy")
+ set (${_PYTHON_PREFIX}_PyPy_VERSION "${CMAKE_MATCH_1}")
else()
string (REGEX REPLACE "^([^ ]+).*" "\\1" ${_PYTHON_PREFIX}_INTERPRETER_ID "${${_PYTHON_PREFIX}_INTERPRETER_ID}")
if (${_PYTHON_PREFIX}_INTERPRETER_ID STREQUAL "Python")
# try to get a more precise ID
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys; print(sys.copyright)"
+ execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
+ "import sys; sys.stdout.write(sys.copyright)"
RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
OUTPUT_VARIABLE ${_PYTHON_PREFIX}_COPYRIGHT
ERROR_QUIET)
@@ -1544,7 +1754,8 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
endif()
# retrieve various package installation directories
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_python_lib(plat_specific=False,standard_lib=True),sysconfig.get_python_lib(plat_specific=True,standard_lib=True),sysconfig.get_python_lib(plat_specific=False,standard_lib=False),sysconfig.get_python_lib(plat_specific=True,standard_lib=False)]))\nexcept Exception:\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_path('stdlib'),sysconfig.get_path('platstdlib'),sysconfig.get_path('purelib'),sysconfig.get_path('platlib')]))"
+ execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
+ "import sys\ntry:\n from distutils import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_python_lib(plat_specific=False,standard_lib=True),sysconfig.get_python_lib(plat_specific=True,standard_lib=True),sysconfig.get_python_lib(plat_specific=False,standard_lib=False),sysconfig.get_python_lib(plat_specific=True,standard_lib=False)]))\nexcept Exception:\n import sysconfig\n sys.stdout.write(';'.join([sysconfig.get_path('stdlib'),sysconfig.get_path('platstdlib'),sysconfig.get_path('purelib'),sysconfig.get_path('platlib')]))"
RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
OUTPUT_VARIABLE _${_PYTHON_PREFIX}_LIBPATHS
ERROR_QUIET)
@@ -1623,42 +1834,104 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
endif()
if (_${_PYTHON_PREFIX}_FIND_STRATEGY STREQUAL "LOCATION")
+ _python_get_names (_${_PYTHON_PREFIX}_COMPILER_NAMES
+ IMPLEMENTATIONS IronPython
+ VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS}
+ COMPILER)
+
+ _python_get_path_suffixes (_${_PYTHON_PREFIX}_PATH_SUFFIXES
+ IMPLEMENTATIONS IronPython
+ VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS}
+ COMPILER)
+
+ _python_get_frameworks (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS
+ IMPLEMENTATIONS IronPython
+ VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS})
_python_get_registries (_${_PYTHON_PREFIX}_REGISTRY_PATHS
IMPLEMENTATIONS IronPython
VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS})
while (TRUE)
- if (_${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "FIRST")
+ # Apple frameworks handling
+ if (CMAKE_HOST_APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "FIRST")
find_program (_${_PYTHON_PREFIX}_COMPILER
- NAMES ipyc
+ NAMES ${_${_PYTHON_PREFIX}_COMPILER_NAMES}
+ NAMES_PER_DIR
+ HINTS ${_${_PYTHON_PREFIX}_IRON_ROOT} ${_${_PYTHON_PREFIX}_HINTS}
+ PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
+ NO_CMAKE_PATH
+ NO_CMAKE_ENVIRONMENT_PATH
+ NO_SYSTEM_ENVIRONMENT_PATH
+ NO_CMAKE_SYSTEM_PATH)
+ _python_validate_compiler (${${_PYTHON_PREFIX}_FIND_VERSION} ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
+ if (_${_PYTHON_PREFIX}_COMPILER)
+ break()
+ endif()
+ endif()
+ # Windows registry
+ if (CMAKE_HOST_WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "FIRST")
+ find_program (_${_PYTHON_PREFIX}_COMPILER
+ NAMES ${_${_PYTHON_PREFIX}_COMPILER_NAMES}
+ NAMES_PER_DIR
HINTS ${_${_PYTHON_PREFIX}_IRON_ROOT} ${_${_PYTHON_PREFIX}_HINTS}
PATHS ${_${_PYTHON_PREFIX}_REGISTRY_PATHS}
- PATH_SUFFIXES ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES}
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
- _python_validate_compiler (${${_PYTHON_PREFIX}_FIND_VERSION})
+ _python_validate_compiler (${${_PYTHON_PREFIX}_FIND_VERSION} ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
if (_${_PYTHON_PREFIX}_COMPILER)
break()
endif()
endif()
+ # try using HINTS
find_program (_${_PYTHON_PREFIX}_COMPILER
- NAMES ipyc
+ NAMES ${_${_PYTHON_PREFIX}_COMPILER_NAMES}
+ NAMES_PER_DIR
HINTS ${_${_PYTHON_PREFIX}_IRON_ROOT} ${_${_PYTHON_PREFIX}_HINTS}
- PATH_SUFFIXES ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES}
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
- _python_validate_compiler (${${_PYTHON_PREFIX}_FIND_VERSION})
+ _python_validate_compiler (${${_PYTHON_PREFIX}_FIND_VERSION} ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
+ if (_${_PYTHON_PREFIX}_COMPILER)
+ break()
+ endif()
+
+ # try using standard paths
+ find_program (_${_PYTHON_PREFIX}_COMPILER
+ NAMES ${_${_PYTHON_PREFIX}_COMPILER_NAMES}
+ NAMES_PER_DIR
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES})
+ _python_validate_compiler (${${_PYTHON_PREFIX}_FIND_VERSION} ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
if (_${_PYTHON_PREFIX}_COMPILER)
break()
endif()
- if (_${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "LAST")
+ # Apple frameworks handling
+ if (CMAKE_HOST_APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "LAST")
find_program (_${_PYTHON_PREFIX}_COMPILER
- NAMES ipyc
+ NAMES ${_${_PYTHON_PREFIX}_COMPILER_NAMES}
+ NAMES_PER_DIR
+ PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
+ NO_DEFAULT_PATH)
+ _python_validate_compiler (${${_PYTHON_PREFIX}_FIND_VERSION} ${_${_PYTHON_PREFIX}_FIND_VERSION_EXACT})
+ if (_${_PYTHON_PREFIX}_COMPILER)
+ break()
+ endif()
+ endif()
+ # Windows registry
+ if (CMAKE_HOST_WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "LAST")
+ find_program (_${_PYTHON_PREFIX}_COMPILER
+ NAMES ${_${_PYTHON_PREFIX}_COMPILER_NAMES}
+ NAMES_PER_DIR
PATHS ${_${_PYTHON_PREFIX}_REGISTRY_PATHS}
- PATH_SUFFIXES ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES}
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_DEFAULT_PATH)
+ if (_${_PYTHON_PREFIX}_COMPILER)
+ break()
+ endif()
endif()
break()
@@ -1666,16 +1939,48 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
else()
# try using root dir and registry
foreach (_${_PYTHON_PREFIX}_VERSION IN LISTS _${_PYTHON_PREFIX}_FIND_VERSIONS)
+ _python_get_names (_${_PYTHON_PREFIX}_COMPILER_NAMES
+ IMPLEMENTATIONS IronPython
+ VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS}
+ COMPILER)
+
+ _python_get_path_suffixes (_${_PYTHON_PREFIX}_PATH_SUFFIXES
+ IMPLEMENTATIONS IronPython
+ VERSION ${_${_PYTHON_PREFIX}_FIND_VERSION}
+ COMPILER)
+
+ _python_get_frameworks (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS
+ IMPLEMENTATIONS IronPython
+ VERSION ${_${_PYTHON_PREFIX}_VERSION})
_python_get_registries (_${_PYTHON_PREFIX}_REGISTRY_PATHS
IMPLEMENTATIONS IronPython
- VERSION ${_${_PYTHON_PREFIX}_VERSIO})
+ VERSION ${_${_PYTHON_PREFIX}_VERSION})
- if (_${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "FIRST")
+ # Apple frameworks handling
+ if (CMAKE_HOST_APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "FIRST")
find_program (_${_PYTHON_PREFIX}_COMPILER
- NAMES ipyc
+ NAMES ${_${_PYTHON_PREFIX}_COMPILER_NAMES}
+ NAMES_PER_DIR
+ HINTS ${_${_PYTHON_PREFIX}_IRON_ROOT} ${_${_PYTHON_PREFIX}_HINTS}
+ PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
+ NO_CMAKE_PATH
+ NO_CMAKE_ENVIRONMENT_PATH
+ NO_SYSTEM_ENVIRONMENT_PATH
+ NO_CMAKE_SYSTEM_PATH)
+ _python_validate_compiler (${_${_PYTHON_PREFIX}_VERSION} EXACT)
+ if (_${_PYTHON_PREFIX}_COMPILER)
+ break()
+ endif()
+ endif()
+ # Windows registry
+ if (CMAKE_HOST_WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "FIRST")
+ find_program (_${_PYTHON_PREFIX}_COMPILER
+ NAMES ${_${_PYTHON_PREFIX}_COMPILER_NAMES}
+ NAMES_PER_DIR
HINTS ${_${_PYTHON_PREFIX}_IRON_ROOT} ${_${_PYTHON_PREFIX}_HINTS}
PATHS ${_${_PYTHON_PREFIX}_REGISTRY_PATHS}
- PATH_SUFFIXES ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES}
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
_python_validate_compiler (${_${_PYTHON_PREFIX}_VERSION} EXACT)
@@ -1684,10 +1989,12 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
endif()
endif()
+ # try using HINTS
find_program (_${_PYTHON_PREFIX}_COMPILER
- NAMES ipyc
+ NAMES ${_${_PYTHON_PREFIX}_COMPILER_NAMES}
+ NAMES_PER_DIR
HINTS ${_${_PYTHON_PREFIX}_IRON_ROOT} ${_${_PYTHON_PREFIX}_HINTS}
- PATH_SUFFIXES ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES}
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
_python_validate_compiler (${_${_PYTHON_PREFIX}_VERSION} EXACT)
@@ -1695,11 +2002,26 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
break()
endif()
- if (_${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "LAST")
+ # Apple frameworks handling
+ if (CMAKE_HOST_APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "LAST")
find_program (_${_PYTHON_PREFIX}_COMPILER
- NAMES ipyc
+ NAMES ${_${_PYTHON_PREFIX}_COMPILER_NAMES}
+ NAMES_PER_DIR
+ PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS}
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
+ NO_DEFAULT_PATH)
+ _python_validate_compiler (${_${_PYTHON_PREFIX}_VERSION} EXACT)
+ if (_${_PYTHON_PREFIX}_COMPILER)
+ break()
+ endif()
+ endif()
+ # Windows registry
+ if (CMAKE_HOST_WIN32 AND _${_PYTHON_PREFIX}_FIND_REGISTRY STREQUAL "LAST")
+ find_program (_${_PYTHON_PREFIX}_COMPILER
+ NAMES ${_${_PYTHON_PREFIX}_COMPILER_NAMES}
+ NAMES_PER_DIR
PATHS ${_${_PYTHON_PREFIX}_REGISTRY_PATHS}
- PATH_SUFFIXES ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES}
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES}
NO_DEFAULT_PATH)
_python_validate_compiler (${_${_PYTHON_PREFIX}_VERSION} EXACT)
if (_${_PYTHON_PREFIX}_COMPILER)
@@ -1709,10 +2031,18 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
endforeach()
# no specific version found, re-try in standard paths
+ _python_get_names (_${_PYTHON_PREFIX}_COMPILER_NAMES
+ IMPLEMENTATIONS IronPython
+ VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS}
+ COMPILER)
+ _python_get_path_suffixes (_${_PYTHON_PREFIX}_PATH_SUFFIXES
+ IMPLEMENTATIONS IronPython
+ VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS}
+ COMPILER)
find_program (_${_PYTHON_PREFIX}_COMPILER
- NAMES ipyc
+ NAMES ${_${_PYTHON_PREFIX}_COMPILER_NAMES}
HINTS ${_${_PYTHON_PREFIX}_IRON_ROOT} ${_${_PYTHON_PREFIX}_HINTS}
- PATH_SUFFIXES ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES})
+ PATH_SUFFIXES ${_${_PYTHON_PREFIX}_PATH_SUFFIXES})
endif()
endif()
@@ -1720,13 +2050,18 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
if (_${_PYTHON_PREFIX}_COMPILER)
# retrieve python environment version from compiler
+ _python_get_launcher (_${_PYTHON_PREFIX}_COMPILER_LAUNCHER COMPILER)
set (_${_PYTHON_PREFIX}_VERSION_DIR "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PythonCompilerVersion.dir")
file (WRITE "${_${_PYTHON_PREFIX}_VERSION_DIR}/version.py" "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:3]]))\n")
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_COMPILER}" /target:exe /embed "${_${_PYTHON_PREFIX}_VERSION_DIR}/version.py"
+ execute_process (COMMAND ${_${_PYTHON_PREFIX}_COMPILER_LAUNCHER} "${_${_PYTHON_PREFIX}_COMPILER}"
+ ${_${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_ARCH_FLAGS}
+ /target:exe /embed "${_${_PYTHON_PREFIX}_VERSION_DIR}/version.py"
WORKING_DIRECTORY "${_${_PYTHON_PREFIX}_VERSION_DIR}"
OUTPUT_QUIET
ERROR_QUIET)
- execute_process (COMMAND "${_${_PYTHON_PREFIX}_VERSION_DIR}/version"
+ get_filename_component (_${_PYTHON_PREFIX}_IR_DIR "${_${_PYTHON_PREFIX}_COMPILER}" DIRECTORY)
+ execute_process (COMMAND "${CMAKE_COMMAND}" -E env "MONO_PATH=${_${_PYTHON_PREFIX}_IR_DIR}"
+ ${${_PYTHON_PREFIX}_DOTNET_LAUNCHER} "${_${_PYTHON_PREFIX}_VERSION_DIR}/version.exe"
WORKING_DIRECTORY "${_${_PYTHON_PREFIX}_VERSION_DIR}"
RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
OUTPUT_VARIABLE _${_PYTHON_PREFIX}_VERSION
@@ -1811,11 +2146,21 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
AND ((${_PYTHON_PREFIX}_Interpreter_FOUND
AND NOT ${_PYTHON_PREFIX}_INTERPRETER_ID STREQUAL "IronPython")
OR NOT ${_PYTHON_PREFIX}_Interpreter_FOUND))
+ if (${_PYTHON_PREFIX}_Interpreter_FOUND)
+ # reduce possible implementations to the interpreter one
+ if (${_PYTHON_PREFIX}_INTERPRETER_ID STREQUAL "PyPy")
+ set (_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS "PyPy")
+ else()
+ set (_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS "CPython")
+ endif()
+ else()
+ list (REMOVE_ITEM _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS "IronPython")
+ endif()
if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS)
- list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_PYTHON_PREFIX}_LIBRARY_RELEASE
- _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE
- _${_PYTHON_PREFIX}_LIBRARY_DEBUG
- _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG)
+ list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_PYTHON_PREFIX}_LIBRARY_RELEASE
+ _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE
+ _${_PYTHON_PREFIX}_LIBRARY_DEBUG
+ _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG)
endif()
if ("INCLUDE_DIR" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS)
list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_PYTHON_PREFIX}_INCLUDE_DIR)
@@ -2255,6 +2600,12 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
NAMES_PER_DIR
HINTS "${_${_PYTHON_PREFIX}_PATH}" ${_${_PYTHON_PREFIX}_HINTS}
NO_DEFAULT_PATH)
+ # second try including CMAKE variables to catch-up non conventional layouts
+ find_library (_${_PYTHON_PREFIX}_LIBRARY_DEBUG
+ NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG}
+ NAMES_PER_DIR
+ NO_SYSTEM_ENVIRONMENT_PATH
+ NO_CMAKE_SYSTEM_PATH)
endif()
# retrieve runtime libraries
@@ -2265,7 +2616,8 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
_python_find_runtime_library (_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE
NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES}
NAMES_PER_DIR
- HINTS "${_${_PYTHON_PREFIX}_PATH}" "${_${_PYTHON_PREFIX}_PATH2}" ${_${_PYTHON_PREFIX}_HINTS}
+ HINTS "${_${_PYTHON_PREFIX}_PATH}"
+ "${_${_PYTHON_PREFIX}_PATH2}" ${_${_PYTHON_PREFIX}_HINTS}
PATH_SUFFIXES bin)
endif()
if (_${_PYTHON_PREFIX}_LIBRARY_DEBUG)
@@ -2275,7 +2627,8 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
_python_find_runtime_library (_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG
NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG}
NAMES_PER_DIR
- HINTS "${_${_PYTHON_PREFIX}_PATH}" "${_${_PYTHON_PREFIX}_PATH2}" ${_${_PYTHON_PREFIX}_HINTS}
+ HINTS "${_${_PYTHON_PREFIX}_PATH}"
+ "${_${_PYTHON_PREFIX}_PATH2}" ${_${_PYTHON_PREFIX}_HINTS}
PATH_SUFFIXES bin)
endif()
endif()
@@ -2391,11 +2744,10 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
# retrieve version from header file
_python_get_version (INCLUDE PREFIX _${_PYTHON_PREFIX}_INC_)
- if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE AND
- NOT _${_PYTHON_PREFIX}_VERSION EQUAL "${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}")
- # update versioning
+ if (_${_PYTHON_PREFIX}_LIBRARY_RELEASE)
if ("${_${_PYTHON_PREFIX}_INC_VERSION_MAJOR}.${_${_PYTHON_PREFIX}_INC_VERSION_MINOR}"
VERSION_EQUAL _${_PYTHON_PREFIX}_VERSION)
+ # update versioning
set (_${_PYTHON_PREFIX}_VERSION ${_${_PYTHON_PREFIX}_INC_VERSION})
set (_${_PYTHON_PREFIX}_VERSION_PATCH ${_${_PYTHON_PREFIX}_INC_VERSION_PATCH})
endif()
@@ -2482,6 +2834,16 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
set (${_PYTHON_PREFIX}_Development_FOUND TRUE)
endif()
+ if ((${_PYTHON_PREFIX}_Development.Module_FOUND
+ OR ${_PYTHON_PREFIX}_Development.Embed_FOUND)
+ AND EXISTS "${_${_PYTHON_PREFIX}_INCLUDE_DIR}/PyPy.h")
+ # retrieve PyPy version
+ file (STRINGS "${_${_PYTHON_PREFIX}_INCLUDE_DIR}/patchlevel.h" ${_PYTHON_PREFIX}_PyPy_VERSION
+ REGEX "^#define[ \t]+PYPY_VERSION[ \t]+\"[^\"]+\"")
+ string (REGEX REPLACE "^#define[ \t]+PYPY_VERSION[ \t]+\"([^\"]+)\".*" "\\1"
+ ${_PYTHON_PREFIX}_PyPy_VERSION "${${_PYTHON_PREFIX}_PyPy_VERSION}")
+ endif()
+
if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR VERSION_GREATER_EQUAL "3"
AND NOT DEFINED ${_PYTHON_PREFIX}_SOABI)
_python_get_config_var (${_PYTHON_PREFIX}_SOABI SOABI)
@@ -2534,8 +2896,8 @@ if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_Inte
endif()
if (NOT _${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR)
- execute_process(COMMAND "${${_PYTHON_PREFIX}_EXECUTABLE}" -c
- "from __future__ import print_function\ntry: import numpy; print(numpy.get_include(), end='')\nexcept:pass\n"
+ execute_process(COMMAND ${${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
+ "import sys\ntry: import numpy; sys.stdout.write(numpy.get_include())\nexcept:pass\n"
RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
OUTPUT_VARIABLE _${_PYTHON_PREFIX}_NumPy_PATH
ERROR_QUIET
@@ -2557,8 +2919,8 @@ if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_Inte
endif()
if (_${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR)
- execute_process (COMMAND "${${_PYTHON_PREFIX}_EXECUTABLE}" -c
- "from __future__ import print_function\ntry: import numpy; print(numpy.__version__, end='')\nexcept:pass\n"
+ execute_process (COMMAND ${${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
+ "import sys\ntry: import numpy; sys.stdout.write(numpy.__version__)\nexcept:pass\n"
RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT
OUTPUT_VARIABLE _${_PYTHON_PREFIX}_NumPy_VERSION)
if (NOT _${_PYTHON_PREFIX}_RESULT)
diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake
index def6f3c..84c0c73 100644
--- a/Modules/FindPython2.cmake
+++ b/Modules/FindPython2.cmake
@@ -86,6 +86,7 @@ This module will set the following variables in your project
* Anaconda
* Canopy
* IronPython
+ * PyPy
``Python2_STDLIB``
Standard platform independent installation directory.
@@ -117,6 +118,8 @@ This module will set the following variables in your project
``Python2_COMPILER_ID``
A short string unique to the compiler. Possible values include:
* IronPython
+``Python2_DOTNET_LAUNCHER``
+ The ``.Net`` interpreter. Only used by ``IronPython`` implementation.
``Python2_Development_FOUND``
System has the Python 2 development artifacts.
``Python2_Development.Module_FOUND``
@@ -139,6 +142,8 @@ This module will set the following variables in your project
Python 2 minor version.
``Python2_VERSION_PATCH``
Python 2 patch version.
+``Python2_PyPy_VERSION``
+ Python 2 PyPy version.
``Python2_NumPy_FOUND``
System has the NumPy.
``Python2_NumPy_INCLUDE_DIRS``
@@ -228,8 +233,14 @@ Hints
* ``IronPython``: This implementation use the ``CSharp`` language for
``.NET Framework`` on top of the `Dynamic Language Runtime` (``DLR``).
See `IronPython <http://ironpython.net>`_.
+ * ``PyPy``: This implementation use ``RPython`` language and
+ ``RPython translation toolchain`` to produce the python interpreter.
+ See `PyPy <https://www.pypy.org>`_.
- The default value is the list: ``CPython``, ``IronPython``.
+ The default value is:
+
+ * Windows platform: ``CPython``, ``IronPython``
+ * Other platforms: ``CPython``
.. note::
@@ -239,6 +250,12 @@ Hints
``Python2_FIND_STRATEGY=LOCATION``, each location will be search first for
``IronPython`` and second for ``CPython``.
+ .. note::
+
+ When ``IronPython`` is specified, on platforms other than ``Windows``, the
+ ``.Net`` interpreter (i.e. ``mono`` command) is expected to be available
+ through the ``PATH`` variable.
+
Artifacts Specification
^^^^^^^^^^^^^^^^^^^^^^^
@@ -251,6 +268,9 @@ setting the following variables:
``Python2_COMPILER``
The path to the compiler.
+``Python2_DOTNET_LAUNCHER``
+ The ``.Net`` interpreter. Only used by ``IronPython`` implementation.
+
``Python2_LIBRARY``
The path to the library. It will be used to compute the
variables ``Python2_LIBRARIES``, ``Python2_LIBRAY_DIRS`` and
diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake
index 3660ee8..f142c07 100644
--- a/Modules/FindPython3.cmake
+++ b/Modules/FindPython3.cmake
@@ -86,6 +86,7 @@ This module will set the following variables in your project
* Anaconda
* Canopy
* IronPython
+ * PyPy
``Python3_STDLIB``
Standard platform independent installation directory.
@@ -126,6 +127,8 @@ This module will set the following variables in your project
``Python3_COMPILER_ID``
A short string unique to the compiler. Possible values include:
* IronPython
+``Python3_DOTNET_LAUNCHER``
+ The ``.Net`` interpreter. Only used by ``IronPython`` implementation.
``Python3_Development_FOUND``
System has the Python 3 development artifacts.
``Python3_Development.Module_FOUND``
@@ -148,6 +151,8 @@ This module will set the following variables in your project
Python 3 minor version.
``Python3_VERSION_PATCH``
Python 3 patch version.
+``Python3_PyPy_VERSION``
+ Python 3 PyPy version.
``Python3_NumPy_FOUND``
System has the NumPy.
``Python3_NumPy_INCLUDE_DIRS``
@@ -278,8 +283,14 @@ Hints
* ``IronPython``: This implementation use the ``CSharp`` language for
``.NET Framework`` on top of the `Dynamic Language Runtime` (``DLR``).
See `IronPython <http://ironpython.net>`_.
+ * ``PyPy``: This implementation use ``RPython`` language and
+ ``RPython translation toolchain`` to produce the python interpreter.
+ See `PyPy <https://www.pypy.org>`_.
- The default value is the list: ``CPython``, ``IronPython``.
+ The default value is:
+
+ * Windows platform: ``CPython``, ``IronPython``
+ * Other platforms: ``CPython``
.. note::
@@ -289,6 +300,12 @@ Hints
``Python3_FIND_STRATEGY=LOCATION``, each location will be search first for
``IronPython`` and second for ``CPython``.
+ .. note::
+
+ When ``IronPython`` is specified, on platforms other than ``Windows``, the
+ ``.Net`` interpreter (i.e. ``mono`` command) is expected to be available
+ through the ``PATH`` variable.
+
Artifacts Specification
^^^^^^^^^^^^^^^^^^^^^^^
@@ -301,6 +318,9 @@ setting the following variables:
``Python3_COMPILER``
The path to the compiler.
+``Python3_DOTNET_LAUNCHER``
+ The ``.Net`` interpreter. Only used by ``IronPython`` implementation.
+
``Python3_LIBRARY``
The path to the library. It will be used to compute the
variables ``Python3_LIBRARIES``, ``Python3_LIBRAY_DIRS`` and
diff --git a/Modules/FindSquish.cmake b/Modules/FindSquish.cmake
index eec8876..91d1410 100644
--- a/Modules/FindSquish.cmake
+++ b/Modules/FindSquish.cmake
@@ -9,8 +9,7 @@ FindSquish
-This module can be used to find Squish. Currently Squish versions 3
-and 4 are supported.
+This module can be used to find Squish.
::
@@ -39,12 +38,12 @@ and 4 are supported.
-It provides the function squish_v4_add_test() for adding a squish test
-to cmake using Squish 4.x:
+It provides the function squish_add_test() for adding a squish test
+to cmake using Squish >= 4.x:
::
- squish_v4_add_test(cmakeTestName
+ squish_add_test(cmakeTestName
AUT targetName SUITE suiteName TEST squishTestName
[SETTINGSGROUP group] [PRE_COMMAND command] [POST_COMMAND command] )
@@ -66,8 +65,7 @@ The arguments have the following meaning:
the name of the squish test, i.e. the name of the subdirectory
of the test inside the suite directory.
``SETTINGSGROUP group``
- if specified, the given settings group will be used for executing the test.
- If not specified, the groupname will be "CTest_<username>"
+ deprecated, this argument will be ignored.
``PRE_COMMAND command``
if specified, the given command will be executed before starting the squish test.
``POST_COMMAND command``
@@ -78,13 +76,12 @@ The arguments have the following meaning:
::
enable_testing()
- find_package(Squish 4.0)
+ find_package(Squish 6.5)
if (SQUISH_FOUND)
- squish_v4_add_test(myTestName
+ squish_add_test(myTestName
AUT myApp
SUITE ${CMAKE_SOURCE_DIR}/tests/mySuite
TEST someSquishTest
- SETTINGSGROUP myGroup
)
endif ()
@@ -105,19 +102,12 @@ provided:
::
enable_testing()
- find_package(Squish)
+ find_package(Squish 3.0)
if (SQUISH_FOUND)
squish_v3_add_test(myTestName myApplication testCase envVars testWrapper)
endif ()
-
-macro SQUISH_ADD_TEST(testName applicationUnderTest testCase envVars
-testWrapper)
-
-::
-
- This is deprecated. Use SQUISH_V3_ADD_TEST() if you are using Squish 3.x instead.
#]=======================================================================]
set(SQUISH_INSTALL_DIR_STRING "Directory containing the bin, doc, and lib directories for Squish; this should be the root of the installation directory.")
@@ -170,9 +160,9 @@ endif()
set(SQUISH_VERSION)
-set(SQUISH_VERSION_MAJOR )
-set(SQUISH_VERSION_MINOR )
-set(SQUISH_VERSION_PATCH )
+set(SQUISH_VERSION_MAJOR)
+set(SQUISH_VERSION_MINOR)
+set(SQUISH_VERSION_PATCH)
# record if executables are set
if(SQUISH_CLIENT_EXECUTABLE)
@@ -204,8 +194,8 @@ find_package_handle_standard_args(Squish REQUIRED_VARS SQUISH_INSTALL_DIR SQUI
set(_SQUISH_MODULE_DIR "${CMAKE_CURRENT_LIST_DIR}")
-macro(SQUISH_V3_ADD_TEST testName testAUT testCase envVars testWraper)
- if("${SQUISH_VERSION_MAJOR}" STREQUAL "4")
+macro(squish_v3_add_test testName testAUT testCase envVars testWraper)
+ if("${SQUISH_VERSION_MAJOR}" STRGREATER "3")
message(STATUS "Using squish_v3_add_test(), but SQUISH_VERSION_MAJOR is ${SQUISH_VERSION_MAJOR}.\nThis may not work.")
endif()
@@ -228,16 +218,9 @@ macro(SQUISH_V3_ADD_TEST testName testAUT testCase envVars testWraper)
endmacro()
-macro(SQUISH_ADD_TEST)
- message(STATUS "Using squish_add_test() is deprecated, use squish_v3_add_test() instead.")
- squish_v3_add_test(${ARGV})
-endmacro()
-
-
-function(SQUISH_V4_ADD_TEST testName)
-
- if(NOT "${SQUISH_VERSION_MAJOR}" STREQUAL "4")
- message(STATUS "Using squish_v4_add_test(), but SQUISH_VERSION_MAJOR is ${SQUISH_VERSION_MAJOR}.\nThis may not work.")
+function(squish_v4_add_test testName)
+ if(NOT "${SQUISH_VERSION_MAJOR}" STRGREATER "3")
+ message(STATUS "Using squish_add_test(), but SQUISH_VERSION_MAJOR is ${SQUISH_VERSION_MAJOR}.\nThis may not work.")
endif()
set(oneValueArgs AUT SUITE TEST SETTINGSGROUP PRE_COMMAND POST_COMMAND)
@@ -270,14 +253,14 @@ function(SQUISH_V4_ADD_TEST testName)
message(FATAL_ERROR "Could not find squish testcase ${_SQUISH_TEST} (checked ${absTestCase})")
endif()
- if(NOT _SQUISH_SETTINGSGROUP)
- set(_SQUISH_SETTINGSGROUP "CTest_$ENV{LOGNAME}")
+ if(_SQUISH_SETTINGSGROUP)
+ message("SETTINGSGROUP is deprecated and will be ignored.")
endif()
add_test(NAME ${testName}
COMMAND ${CMAKE_COMMAND} -V -VV
"-Dsquish_version:STRING=4"
- "-Dsquish_aut:STRING=$<TARGET_FILE_NAME:${_SQUISH_AUT}>"
+ "-Dsquish_aut:STRING=$<TARGET_FILE_BASE_NAME:${_SQUISH_AUT}>"
"-Dsquish_aut_dir:STRING=$<TARGET_FILE_DIR:${_SQUISH_AUT}>"
"-Dsquish_server_executable:STRING=${SQUISH_SERVER_EXECUTABLE}"
"-Dsquish_client_executable:STRING=${SQUISH_CLIENT_EXECUTABLE}"
@@ -287,7 +270,6 @@ function(SQUISH_V4_ADD_TEST testName)
"-Dsquish_env_vars:STRING=${envVars}"
"-Dsquish_wrapper:STRING=${testWraper}"
"-Dsquish_module_dir:STRING=${_SQUISH_MODULE_DIR}"
- "-Dsquish_settingsgroup:STRING=${_SQUISH_SETTINGSGROUP}"
"-Dsquish_pre_command:STRING=${_SQUISH_PRE_COMMAND}"
"-Dsquish_post_command:STRING=${_SQUISH_POST_COMMAND}"
-P "${_SQUISH_MODULE_DIR}/SquishTestScript.cmake"
@@ -296,3 +278,11 @@ function(SQUISH_V4_ADD_TEST testName)
PROPERTIES FAIL_REGULAR_EXPRESSION "FAIL;FAILED;ERROR;FATAL"
)
endfunction()
+
+macro(squish_add_test)
+ if("${SQUISH_VERSION_MAJOR}" STRGREATER "3")
+ squish_v4_add_test(${ARGV})
+ else()
+ squish_v3_add_test(${ARGV})
+ endif()
+endmacro()
diff --git a/Modules/FindVulkan.cmake b/Modules/FindVulkan.cmake
index 7603124..4b999b6 100644
--- a/Modules/FindVulkan.cmake
+++ b/Modules/FindVulkan.cmake
@@ -28,6 +28,15 @@ The module will also define two cache variables::
Vulkan_INCLUDE_DIR - the Vulkan include directory
Vulkan_LIBRARY - the path to the Vulkan library
+Hints
+^^^^^
+
+The ``VULKAN_SDK`` environment variable optionally specifies the
+location of the Vulkan SDK root directory for the given
+architecture. It is typically set by sourcing the toplevel
+``setup-env.sh`` script of the Vulkan SDK directory into the shell
+environment.
+
#]=======================================================================]
if(WIN32)
@@ -53,14 +62,12 @@ if(WIN32)
)
endif()
else()
- find_path(Vulkan_INCLUDE_DIR
- NAMES vulkan/vulkan.h
- PATHS
- "$ENV{VULKAN_SDK}/include")
- find_library(Vulkan_LIBRARY
- NAMES vulkan
- PATHS
- "$ENV{VULKAN_SDK}/lib")
+ find_path(Vulkan_INCLUDE_DIR
+ NAMES vulkan/vulkan.h
+ HINTS "$ENV{VULKAN_SDK}/include")
+ find_library(Vulkan_LIBRARY
+ NAMES vulkan
+ HINTS "$ENV{VULKAN_SDK}/lib")
endif()
set(Vulkan_LIBRARIES ${Vulkan_LIBRARY})
diff --git a/Modules/GoogleTestAddTests.cmake b/Modules/GoogleTestAddTests.cmake
index 499332f..4af62ed 100644
--- a/Modules/GoogleTestAddTests.cmake
+++ b/Modules/GoogleTestAddTests.cmake
@@ -83,6 +83,8 @@ function(gtest_discover_tests_impl)
)
endif()
+ # Preserve semicolon in test-parameters
+ string(REPLACE [[;]] [[\;]] output "${output}")
string(REPLACE "\n" ";" output "${output}")
# Parse output
@@ -114,9 +116,19 @@ function(gtest_discover_tests_impl)
else()
unset(TEST_XML_OUTPUT_PARAM)
endif()
+
+ # sanitize test name for further processing downstream
+ set(testname "${prefix}${pretty_suite}.${pretty_test}${suffix}")
+ # escape \
+ string(REPLACE [[\]] [[\\]] testname "${testname}")
+ # escape ;
+ string(REPLACE [[;]] [[\;]] testname "${testname}")
+ # escape $
+ string(REPLACE [[$]] [[\$]] testname "${testname}")
+
# ...and add to script
add_command(add_test
- "${prefix}${pretty_suite}.${pretty_test}${suffix}"
+ "${testname}"
${_TEST_EXECUTOR}
"${_TEST_EXECUTABLE}"
"--gtest_filter=${suite}.${test}"
@@ -126,18 +138,18 @@ function(gtest_discover_tests_impl)
)
if(suite MATCHES "^DISABLED" OR test MATCHES "^DISABLED")
add_command(set_tests_properties
- "${prefix}${pretty_suite}.${pretty_test}${suffix}"
+ "${testname}"
PROPERTIES DISABLED TRUE
)
endif()
add_command(set_tests_properties
- "${prefix}${pretty_suite}.${pretty_test}${suffix}"
+ "${testname}"
PROPERTIES
WORKING_DIRECTORY "${_TEST_WORKING_DIR}"
SKIP_REGULAR_EXPRESSION "\\\\[ SKIPPED \\\\]"
${properties}
)
- list(APPEND tests_buffer "${prefix}${pretty_suite}.${pretty_test}${suffix}")
+ list(APPEND tests_buffer "${testname}")
list(LENGTH tests_buffer tests_buffer_length)
if(${tests_buffer_length} GREATER "250")
flush_tests_buffer()
diff --git a/Modules/Internal/CUDAToolkit.cmake b/Modules/Internal/CUDAToolkit.cmake
new file mode 100644
index 0000000..ab1e568
--- /dev/null
+++ b/Modules/Internal/CUDAToolkit.cmake
@@ -0,0 +1,225 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+# This file is for sharing code for finding basic CUDA toolkit information between
+# CMakeDetermineCUDACompiler.cmake and FindCUDAToolkit.cmake.
+
+# For NVCC we can easily deduce the SDK binary directory from the compiler path.
+if(CMAKE_CUDA_COMPILER_LOADED AND NOT CUDAToolkit_BIN_DIR AND CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
+ get_filename_component(cuda_dir "${CMAKE_CUDA_COMPILER}" DIRECTORY)
+ set(CUDAToolkit_BIN_DIR "${cuda_dir}" CACHE PATH "")
+ mark_as_advanced(CUDAToolkit_BIN_DIR)
+ unset(cuda_dir)
+endif()
+
+# Try language- or user-provided path first.
+if(CUDAToolkit_BIN_DIR)
+ find_program(CUDAToolkit_NVCC_EXECUTABLE
+ NAMES nvcc nvcc.exe
+ PATHS ${CUDAToolkit_BIN_DIR}
+ NO_DEFAULT_PATH
+ )
+endif()
+
+# Search using CUDAToolkit_ROOT
+find_program(CUDAToolkit_NVCC_EXECUTABLE
+ NAMES nvcc nvcc.exe
+ PATHS ENV CUDA_PATH
+ PATH_SUFFIXES bin
+)
+
+# If the user specified CUDAToolkit_ROOT but nvcc could not be found, this is an error.
+if(NOT CUDAToolkit_NVCC_EXECUTABLE AND (DEFINED CUDAToolkit_ROOT OR DEFINED ENV{CUDAToolkit_ROOT}))
+ # Declare error messages now, print later depending on find_package args.
+ set(fail_base "Could not find nvcc executable in path specified by")
+ set(cuda_root_fail "${fail_base} CUDAToolkit_ROOT=${CUDAToolkit_ROOT}")
+ set(env_cuda_root_fail "${fail_base} environment variable CUDAToolkit_ROOT=$ENV{CUDAToolkit_ROOT}")
+
+ if(CUDAToolkit_FIND_REQUIRED)
+ if(DEFINED CUDAToolkit_ROOT)
+ message(FATAL_ERROR ${cuda_root_fail})
+ elseif(DEFINED ENV{CUDAToolkit_ROOT})
+ message(FATAL_ERROR ${env_cuda_root_fail})
+ endif()
+ else()
+ if(NOT CUDAToolkit_FIND_QUIETLY)
+ if(DEFINED CUDAToolkit_ROOT)
+ message(STATUS ${cuda_root_fail})
+ elseif(DEFINED ENV{CUDAToolkit_ROOT})
+ message(STATUS ${env_cuda_root_fail})
+ endif()
+ endif()
+ set(CUDAToolkit_FOUND FALSE)
+ unset(fail_base)
+ unset(cuda_root_fail)
+ unset(env_cuda_root_fail)
+ return()
+ endif()
+endif()
+
+# CUDAToolkit_ROOT cmake / env variable not specified, try platform defaults.
+#
+# - Linux: /usr/local/cuda-X.Y
+# - macOS: /Developer/NVIDIA/CUDA-X.Y
+# - Windows: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\vX.Y
+#
+# We will also search the default symlink location /usr/local/cuda first since
+# if CUDAToolkit_ROOT is not specified, it is assumed that the symlinked
+# directory is the desired location.
+if(NOT CUDAToolkit_NVCC_EXECUTABLE)
+ if(UNIX)
+ if(NOT APPLE)
+ set(platform_base "/usr/local/cuda-")
+ else()
+ set(platform_base "/Developer/NVIDIA/CUDA-")
+ endif()
+ else()
+ set(platform_base "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v")
+ endif()
+
+ # Build out a descending list of possible cuda installations, e.g.
+ file(GLOB possible_paths "${platform_base}*")
+ # Iterate the glob results and create a descending list.
+ set(possible_versions)
+ foreach (p ${possible_paths})
+ # Extract version number from end of string
+ string(REGEX MATCH "[0-9][0-9]?\\.[0-9]$" p_version ${p})
+ if(IS_DIRECTORY ${p} AND p_version)
+ list(APPEND possible_versions ${p_version})
+ endif()
+ endforeach()
+
+ # Cannot use list(SORT) because that is alphabetical, we need numerical.
+ # NOTE: this is not an efficient sorting strategy. But even if a user had
+ # every possible version of CUDA installed, this wouldn't create any
+ # significant overhead.
+ set(versions)
+ foreach (v ${possible_versions})
+ list(LENGTH versions num_versions)
+ # First version, nothing to compare with so just append.
+ if(num_versions EQUAL 0)
+ list(APPEND versions ${v})
+ else()
+ # Loop through list. Insert at an index when comparison is
+ # VERSION_GREATER since we want a descending list. Duplicates will not
+ # happen since this came from a glob list of directories.
+ set(i 0)
+ set(early_terminate FALSE)
+ while (i LESS num_versions)
+ list(GET versions ${i} curr)
+ if(v VERSION_GREATER curr)
+ list(INSERT versions ${i} ${v})
+ set(early_terminate TRUE)
+ break()
+ endif()
+ math(EXPR i "${i} + 1")
+ endwhile()
+ # If it did not get inserted, place it at the end.
+ if(NOT early_terminate)
+ list(APPEND versions ${v})
+ endif()
+ endif()
+ endforeach()
+
+ # With a descending list of versions, populate possible paths to search.
+ set(search_paths)
+ foreach (v ${versions})
+ list(APPEND search_paths "${platform_base}${v}")
+ endforeach()
+
+ # Force the global default /usr/local/cuda to the front on Unix.
+ if(UNIX)
+ list(INSERT search_paths 0 "/usr/local/cuda")
+ endif()
+
+ # Now search for nvcc again using the platform default search paths.
+ find_program(CUDAToolkit_NVCC_EXECUTABLE
+ NAMES nvcc nvcc.exe
+ PATHS ${search_paths}
+ PATH_SUFFIXES bin
+ )
+
+ # We are done with these variables now, cleanup for caller.
+ unset(platform_base)
+ unset(possible_paths)
+ unset(possible_versions)
+ unset(versions)
+ unset(i)
+ unset(early_terminate)
+ unset(search_paths)
+
+ if(NOT CUDAToolkit_NVCC_EXECUTABLE)
+ if(CUDAToolkit_FIND_REQUIRED)
+ message(FATAL_ERROR "Could not find nvcc, please set CUDAToolkit_ROOT.")
+ elseif(NOT CUDAToolkit_FIND_QUIETLY)
+ message(STATUS "Could not find nvcc, please set CUDAToolkit_ROOT.")
+ endif()
+
+ set(CUDAToolkit_FOUND FALSE)
+ return()
+ endif()
+endif()
+
+if(NOT CUDAToolkit_BIN_DIR AND CUDAToolkit_NVCC_EXECUTABLE)
+ get_filename_component(cuda_dir "${CUDAToolkit_NVCC_EXECUTABLE}" DIRECTORY)
+ set(CUDAToolkit_BIN_DIR "${cuda_dir}" CACHE PATH "" FORCE)
+ mark_as_advanced(CUDAToolkit_BIN_DIR)
+ unset(cuda_dir)
+endif()
+
+get_filename_component(CUDAToolkit_ROOT_DIR ${CUDAToolkit_BIN_DIR} DIRECTORY ABSOLUTE)
+
+# Handle cross compilation
+if(CMAKE_CROSSCOMPILING)
+ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7-a")
+ # Support for NVPACK
+ set(CUDAToolkit_TARGET_NAME "armv7-linux-androideabi")
+ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
+ # Support for arm cross compilation
+ set(CUDAToolkit_TARGET_NAME "armv7-linux-gnueabihf")
+ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
+ # Support for aarch64 cross compilation
+ if(ANDROID_ARCH_NAME STREQUAL "arm64")
+ set(CUDAToolkit_TARGET_NAME "aarch64-linux-androideabi")
+ else()
+ set(CUDAToolkit_TARGET_NAME "aarch64-linux")
+ endif(ANDROID_ARCH_NAME STREQUAL "arm64")
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+ set(CUDAToolkit_TARGET_NAME "x86_64-linux")
+ endif()
+
+ if(EXISTS "${CUDAToolkit_ROOT_DIR}/targets/${CUDAToolkit_TARGET_NAME}")
+ set(CUDAToolkit_TARGET_DIR "${CUDAToolkit_ROOT_DIR}/targets/${CUDAToolkit_TARGET_NAME}")
+ # add known CUDA target root path to the set of directories we search for programs, libraries and headers
+ list(PREPEND CMAKE_FIND_ROOT_PATH "${CUDAToolkit_TARGET_DIR}")
+
+ # Mark that we need to pop the root search path changes after we have
+ # found all cuda libraries so that searches for our cross-compilation
+ # libraries work when another cuda sdk is in CMAKE_PREFIX_PATH or
+ # PATh
+ set(_CUDAToolkit_Pop_ROOT_PATH True)
+ endif()
+else()
+ # Not cross compiling
+ set(CUDAToolkit_TARGET_DIR "${CUDAToolkit_ROOT_DIR}")
+ # Now that we have the real ROOT_DIR, find components inside it.
+ list(APPEND CMAKE_PREFIX_PATH ${CUDAToolkit_ROOT_DIR})
+
+ # Mark that we need to pop the prefix path changes after we have
+ # found the cudart library.
+ set(_CUDAToolkit_Pop_Prefix True)
+endif()
+
+# Find the include/ directory
+find_path(CUDAToolkit_INCLUDE_DIR
+ NAMES cuda_runtime.h
+)
+
+# Find a tentative CUDAToolkit_LIBRARY_DIR. FindCUDAToolkit overrides it by searching for the CUDA runtime,
+# but we can't do that here, as CMakeDetermineCUDACompiler wants to use it before the variables necessary
+# for find_library() have been initialized.
+if(EXISTS "${CUDAToolkit_TARGET_DIR}/lib64")
+ set(CUDAToolkit_LIBRARY_DIR "${CUDAToolkit_TARGET_DIR}/lib64")
+elseif(EXISTS "${CUDAToolkit_TARGET_DIR}/lib")
+ set(CUDAToolkit_LIBRARY_DIR "${CUDAToolkit_TARGET_DIR}/lib")
+endif()
diff --git a/Modules/Platform/DOS-OpenWatcom-C.cmake b/Modules/Platform/DOS-OpenWatcom-C.cmake
new file mode 100644
index 0000000..cf71c84
--- /dev/null
+++ b/Modules/Platform/DOS-OpenWatcom-C.cmake
@@ -0,0 +1 @@
+include(Platform/DOS-OpenWatcom)
diff --git a/Modules/Platform/DOS-OpenWatcom-CXX.cmake b/Modules/Platform/DOS-OpenWatcom-CXX.cmake
new file mode 100644
index 0000000..cf71c84
--- /dev/null
+++ b/Modules/Platform/DOS-OpenWatcom-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/DOS-OpenWatcom)
diff --git a/Modules/Platform/DOS-OpenWatcom.cmake b/Modules/Platform/DOS-OpenWatcom.cmake
new file mode 100644
index 0000000..54c452e
--- /dev/null
+++ b/Modules/Platform/DOS-OpenWatcom.cmake
@@ -0,0 +1,28 @@
+
+# This module is shared by multiple languages; use include blocker.
+include_guard()
+
+set(CMAKE_BUILD_TYPE_INIT Debug)
+
+if(DEFINED CMAKE_SYSTEM_PROCESSOR AND CMAKE_SYSTEM_PROCESSOR STREQUAL "I86")
+ string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " system dos")
+ string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " system dos")
+ string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT " system dos")
+else()
+ string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " system dos4g")
+ string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " system dos4g")
+ string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT " system dos4g")
+endif()
+
+set(CMAKE_C_COMPILE_OPTIONS_DLL "-bd") # Note: This variable is a ';' separated list
+set(CMAKE_SHARED_LIBRARY_C_FLAGS "-bd") # ... while this is a space separated string.
+
+string(APPEND CMAKE_C_FLAGS_INIT " -bt=dos")
+string(APPEND CMAKE_CXX_FLAGS_INIT " -bt=dos -xs")
+
+if(NOT CMAKE_C_STANDARD_INCLUDE_DIRECTORIES)
+ set(CMAKE_C_STANDARD_INCLUDE_DIRECTORIES $ENV{WATCOM}/h)
+endif()
+if(NOT CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES)
+ set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES $ENV{WATCOM}/h)
+endif()
diff --git a/Modules/Platform/DOS.cmake b/Modules/Platform/DOS.cmake
new file mode 100644
index 0000000..fc95936
--- /dev/null
+++ b/Modules/Platform/DOS.cmake
@@ -0,0 +1,14 @@
+set(DOS 1)
+
+set(CMAKE_STATIC_LIBRARY_PREFIX "")
+set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib")
+set(CMAKE_SHARED_LIBRARY_PREFIX "")
+set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll")
+set(CMAKE_IMPORT_LIBRARY_PREFIX "")
+set(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib")
+set(CMAKE_EXECUTABLE_SUFFIX ".exe")
+set(CMAKE_LINK_LIBRARY_SUFFIX ".lib")
+set(CMAKE_DL_LIBS "")
+
+set(CMAKE_FIND_LIBRARY_PREFIXES "")
+set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
diff --git a/Modules/Platform/Linux-OpenWatcom.cmake b/Modules/Platform/Linux-OpenWatcom.cmake
index df23366..5b4e995 100644
--- a/Modules/Platform/Linux-OpenWatcom.cmake
+++ b/Modules/Platform/Linux-OpenWatcom.cmake
@@ -4,13 +4,22 @@
# This module is shared by multiple languages; use include blocker.
include_guard()
-string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " system linux")
-string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT " system linux")
-string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " system linux")
-
set(CMAKE_BUILD_TYPE_INIT Debug)
+string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " system linux opt noextension")
+string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT " system linux")
+string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " system linux")
+
# single/multi-threaded /-bm
# default is setup for single-threaded libraries
string(APPEND CMAKE_C_FLAGS_INIT " -bt=linux")
string(APPEND CMAKE_CXX_FLAGS_INIT " -bt=linux -xs")
+
+if(CMAKE_CROSSCOMPILING)
+ if(NOT CMAKE_C_STANDARD_INCLUDE_DIRECTORIES)
+ set(CMAKE_C_STANDARD_INCLUDE_DIRECTORIES $ENV{WATCOM}/lh)
+ endif()
+ if(NOT CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES)
+ set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES $ENV{WATCOM}/lh)
+ endif()
+endif()
diff --git a/Modules/Platform/OS2-OpenWatcom-C.cmake b/Modules/Platform/OS2-OpenWatcom-C.cmake
new file mode 100644
index 0000000..21a4d9e
--- /dev/null
+++ b/Modules/Platform/OS2-OpenWatcom-C.cmake
@@ -0,0 +1 @@
+include(Platform/OS2-OpenWatcom)
diff --git a/Modules/Platform/OS2-OpenWatcom-CXX.cmake b/Modules/Platform/OS2-OpenWatcom-CXX.cmake
new file mode 100644
index 0000000..21a4d9e
--- /dev/null
+++ b/Modules/Platform/OS2-OpenWatcom-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/OS2-OpenWatcom)
diff --git a/Modules/Platform/OS2-OpenWatcom.cmake b/Modules/Platform/OS2-OpenWatcom.cmake
new file mode 100644
index 0000000..998fb9f
--- /dev/null
+++ b/Modules/Platform/OS2-OpenWatcom.cmake
@@ -0,0 +1,35 @@
+# This module is shared by multiple languages; use include blocker.
+include_guard()
+
+set(CMAKE_BUILD_TYPE_INIT Debug)
+
+if(DEFINED CMAKE_SYSTEM_PROCESSOR AND CMAKE_SYSTEM_PROCESSOR STREQUAL "I86")
+ string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " system os2")
+ string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " system os2_dll")
+ string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT " system os2_dll")
+else()
+ string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " system os2v2")
+ string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " system os2v2_dll")
+ string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT " system os2v2_dll")
+endif()
+
+set(CMAKE_C_COMPILE_OPTIONS_DLL "-bd") # Note: This variable is a ';' separated list
+set(CMAKE_SHARED_LIBRARY_C_FLAGS "-bd") # ... while this is a space separated string.
+
+string(APPEND CMAKE_C_FLAGS_INIT " -bt=os2")
+string(APPEND CMAKE_CXX_FLAGS_INIT " -bt=os2 -xs")
+
+if(NOT CMAKE_C_STANDARD_INCLUDE_DIRECTORIES)
+ if(DEFINED CMAKE_SYSTEM_PROCESSOR AND CMAKE_SYSTEM_PROCESSOR STREQUAL "I86")
+ set(CMAKE_C_STANDARD_INCLUDE_DIRECTORIES $ENV{WATCOM}/h $ENV{WATCOM}/h/os21x)
+ else()
+ set(CMAKE_C_STANDARD_INCLUDE_DIRECTORIES $ENV{WATCOM}/h $ENV{WATCOM}/h/os2)
+ endif()
+endif()
+if(NOT CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES)
+ if(DEFINED CMAKE_SYSTEM_PROCESSOR AND CMAKE_SYSTEM_PROCESSOR STREQUAL "I86")
+ set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES $ENV{WATCOM}/h $ENV{WATCOM}/h/os21x)
+ else()
+ set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES $ENV{WATCOM}/h $ENV{WATCOM}/h/os2)
+ endif()
+endif()
diff --git a/Modules/Platform/OS2.cmake b/Modules/Platform/OS2.cmake
new file mode 100644
index 0000000..a9df66d
--- /dev/null
+++ b/Modules/Platform/OS2.cmake
@@ -0,0 +1,14 @@
+set(OS2 1)
+
+set(CMAKE_STATIC_LIBRARY_PREFIX "")
+set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib")
+set(CMAKE_SHARED_LIBRARY_PREFIX "")
+set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll")
+set(CMAKE_IMPORT_LIBRARY_PREFIX "")
+set(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib")
+set(CMAKE_EXECUTABLE_SUFFIX ".exe")
+set(CMAKE_LINK_LIBRARY_SUFFIX ".lib")
+set(CMAKE_DL_LIBS "")
+
+set(CMAKE_FIND_LIBRARY_PREFIXES "")
+set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake
index 98c83aa..b9381c3 100644
--- a/Modules/Platform/UnixPaths.cmake
+++ b/Modules/Platform/UnixPaths.cmake
@@ -21,6 +21,10 @@ get_filename_component(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH)
# List common installation prefixes. These will be used for all
# search types.
+#
+# Reminder when adding new locations computed from environment variables
+# please make sure to keep Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst
+# synchronized
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
# Standard
/usr/local /usr /
@@ -86,8 +90,15 @@ set(_CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES_INIT
unset(_cmake_sysroot_compile)
+# Reminder when adding new locations computed from environment variables
+# please make sure to keep Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst
+# synchronized
if(CMAKE_COMPILER_SYSROOT)
list(PREPEND CMAKE_SYSTEM_PREFIX_PATH "${CMAKE_COMPILER_SYSROOT}")
+
+ if(DEFINED ENV{CONDA_PREFIX} AND EXISTS "$ENV{CONDA_PREFIX}")
+ list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{CONDA_PREFIX}")
+ endif()
endif()
# Enable use of lib32 and lib64 search path variants by default.
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index 7ee501b..2476a33 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -331,13 +331,11 @@ macro(__windows_compiler_msvc lang)
set(CMAKE_PCH_EXTENSION .pch)
set(CMAKE_LINK_PCH ON)
- if(MSVC_VERSION GREATER_EQUAL 1910)
- # VS 2017 or greater
- if (NOT ${CMAKE_${lang}_COMPILER_ID} STREQUAL "Clang")
- set(CMAKE_PCH_PROLOGUE "#pragma system_header")
- else()
- set(CMAKE_PCH_PROLOGUE "#pragma clang system_header")
- endif()
+ if (CMAKE_${lang}_COMPILER_ID STREQUAL "Clang")
+ set(CMAKE_PCH_PROLOGUE "#pragma clang system_header")
+ elseif(MSVC_VERSION GREATER_EQUAL 1913)
+ # At least MSVC toolet 14.13 from VS 2017 15.6
+ set(CMAKE_PCH_PROLOGUE "#pragma system_header")
endif()
if (NOT ${CMAKE_${lang}_COMPILER_ID} STREQUAL "Clang")
set(CMAKE_PCH_COPY_COMPILE_PDB ON)
diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
index f425cf8..a88f4bc 100644
--- a/Modules/Platform/Windows-NVIDIA-CUDA.cmake
+++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
@@ -69,11 +69,14 @@ else()
endif()
unset(_cmp0092)
-set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "STATIC")
set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "cudadevrt;cudart_static")
set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_SHARED "cudadevrt;cudart")
set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_NONE "")
+if(UNIX)
+ list(APPEND CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "rt" "pthread" "dl")
+endif()
+
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")
diff --git a/Modules/Platform/Windows-OpenWatcom.cmake b/Modules/Platform/Windows-OpenWatcom.cmake
index 4c0e57e..70055da 100644
--- a/Modules/Platform/Windows-OpenWatcom.cmake
+++ b/Modules/Platform/Windows-OpenWatcom.cmake
@@ -4,6 +4,8 @@
# This module is shared by multiple languages; use include blocker.
include_guard()
+set(CMAKE_BUILD_TYPE_INIT Debug)
+
set(CMAKE_CREATE_WIN32_EXE "system nt_win" )
set(CMAKE_CREATE_CONSOLE_EXE "system nt" )
string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " system nt_dll")
@@ -14,10 +16,17 @@ set(CMAKE_SHARED_LIBRARY_C_FLAGS "-bd") # ... while this is a space separated st
set(CMAKE_RC_COMPILER "rc" )
-set(CMAKE_BUILD_TYPE_INIT Debug)
-
# single/multi-threaded /-bm
# static/DLL run-time libraries /-br
# default is setup for multi-threaded + DLL run-time libraries
string(APPEND CMAKE_C_FLAGS_INIT " -bt=nt -dWIN32 -br -bm")
string(APPEND CMAKE_CXX_FLAGS_INIT " -bt=nt -xs -dWIN32 -br -bm")
+
+if(CMAKE_CROSSCOMPILING)
+ if(NOT CMAKE_C_STANDARD_INCLUDE_DIRECTORIES)
+ set(CMAKE_C_STANDARD_INCLUDE_DIRECTORIES $ENV{WATCOM}/h $ENV{WATCOM}/h/nt)
+ endif()
+ if(NOT CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES)
+ set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES $ENV{WATCOM}/h $ENV{WATCOM}/h/nt)
+ endif()
+endif()
diff --git a/Modules/Platform/WindowsPaths.cmake b/Modules/Platform/WindowsPaths.cmake
index 71cc609..b9e2f17 100644
--- a/Modules/Platform/WindowsPaths.cmake
+++ b/Modules/Platform/WindowsPaths.cmake
@@ -24,6 +24,10 @@ set(__WINDOWS_PATHS_INCLUDED 1)
# ENV{ProgramFiles(x86)} = [C:\Program Files (x86)]
# ENV{ProgramFiles} = [C:\Program Files (x86)]
# ENV{ProgramW6432} = [C:\Program Files]
+#
+# Reminder when adding new locations computed from environment variables
+# please make sure to keep Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst
+# synchronized
set(_programfiles "")
foreach(v "ProgramW6432" "ProgramFiles" "ProgramFiles(x86)")
if(DEFINED "ENV{${v}}")
diff --git a/Modules/Squish4RunTestCase.bat b/Modules/Squish4RunTestCase.bat
index 5bd815a..fe303b8 100755
--- a/Modules/Squish4RunTestCase.bat
+++ b/Modules/Squish4RunTestCase.bat
@@ -4,7 +4,6 @@ set TESTSUITE=%3
set TESTCASE=%4
set AUT=%5
set AUTDIR=%6
-set SETTINGSGROUP=%7
%SQUISHSERVER% --stop
@@ -14,7 +13,7 @@ echo "Adding AUT... %SQUISHSERVER% --config addAUT %AUT% %AUTDIR%"
echo "Starting the squish server... %SQUISHSERVER%"
start /B "Squish Server" %SQUISHSERVER%
-echo "Running the test case...%SQUISHRUNNER% --testsuite %TESTSUITE% --testcase %TESTCASE%"
+echo "Running the test case... %SQUISHRUNNER% --testsuite %TESTSUITE% --testcase %TESTCASE%"
%SQUISHRUNNER% --testsuite "%TESTSUITE%" --testcase "%TESTCASE%"
set returnValue=%ERRORLEVEL%
diff --git a/Modules/Squish4RunTestCase.sh b/Modules/Squish4RunTestCase.sh
index 39a3907..4d1e382 100755
--- a/Modules/Squish4RunTestCase.sh
+++ b/Modules/Squish4RunTestCase.sh
@@ -6,20 +6,19 @@ TESTSUITE=$3
TESTCASE=$4
AUT=$5
AUTDIR=$6
-SETTINGSGROUP=$7
$SQUISHSERVER --stop > /dev/null 2>&1
-echo "Adding AUT... $SQUISHSERVER --settingsGroup $SETTINGSGROUP --config addAUT $AUT $AUTDIR"
-$SQUISHSERVER --settingsGroup "$SETTINGSGROUP" --config addAUT "$AUT" "$AUTDIR" || exit 255
+echo "Adding AUT... $SQUISHSERVER --config addAUT $AUT $AUTDIR"
+$SQUISHSERVER --config addAUT "$AUT" "$AUTDIR" || exit 255
# sleep 1
echo "Starting the squish server... $SQUISHSERVER --daemon"
$SQUISHSERVER --daemon || exit 255
# sleep 2
-echo "Running the test case...$SQUISHRUNNER --settingsGroup $SETTINGSGROUP --testsuite $TESTSUITE --testcase $TESTCASE"
-$SQUISHRUNNER --settingsGroup "$SETTINGSGROUP" --testsuite "$TESTSUITE" --testcase "$TESTCASE"
+echo "Running the test case... $SQUISHRUNNER --testsuite $TESTSUITE --testcase $TESTCASE"
+$SQUISHRUNNER --testsuite "$TESTSUITE" --testcase "$TESTCASE"
returnValue=$?
echo "Stopping the squish server... $SQUISHSERVER --stop"
diff --git a/Modules/SquishTestScript.cmake b/Modules/SquishTestScript.cmake
index 2a80be5..b0cb4af 100644
--- a/Modules/SquishTestScript.cmake
+++ b/Modules/SquishTestScript.cmake
@@ -31,7 +31,6 @@ message(STATUS "squish_test_case='${squish_test_case}'")
message(STATUS "squish_wrapper='${squish_wrapper}'")
message(STATUS "squish_env_vars='${squish_env_vars}'")
message(STATUS "squish_module_dir='${squish_module_dir}'")
-message(STATUS "squish_settingsgroup='${squish_settingsgroup}'")
message(STATUS "squish_pre_command='${squish_pre_command}'")
message(STATUS "squish_post_command='${squish_post_command}'")
@@ -57,10 +56,10 @@ endif()
# run the test
if("${squish_version}" STREQUAL "4")
if (WIN32)
- execute_process(COMMAND ${squish_module_dir}/Squish4RunTestCase.bat ${squish_server_executable} ${squish_client_executable} ${squish_test_suite} ${squish_test_case} ${squish_aut} ${squish_aut_dir} ${squish_settingsgroup}
+ execute_process(COMMAND ${squish_module_dir}/Squish4RunTestCase.bat ${squish_server_executable} ${squish_client_executable} ${squish_test_suite} ${squish_test_case} ${squish_aut} ${squish_aut_dir}
RESULT_VARIABLE test_rv )
elseif(UNIX)
- execute_process(COMMAND ${squish_module_dir}/Squish4RunTestCase.sh ${squish_server_executable} ${squish_client_executable} ${squish_test_suite} ${squish_test_case} ${squish_aut} ${squish_aut_dir} ${squish_settingsgroup}
+ execute_process(COMMAND ${squish_module_dir}/Squish4RunTestCase.sh ${squish_server_executable} ${squish_client_executable} ${squish_test_suite} ${squish_test_case} ${squish_aut} ${squish_aut_dir}
RESULT_VARIABLE test_rv )
endif ()
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index ec473d2..22d8032 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -383,8 +383,6 @@ set(SRCS
cmProperty.h
cmPropertyDefinition.cxx
cmPropertyDefinition.h
- cmPropertyDefinitionMap.cxx
- cmPropertyDefinitionMap.h
cmPropertyMap.cxx
cmPropertyMap.h
cmQtAutoGen.cxx
@@ -490,10 +488,10 @@ set(SRCS
cmBuildCommand.h
cmBuildNameCommand.cxx
cmBuildNameCommand.h
- cmCMakeCommand.cxx
- cmCMakeCommand.h
cmCMakeHostSystemInformationCommand.cxx
cmCMakeHostSystemInformationCommand.h
+ cmCMakeLanguageCommand.cxx
+ cmCMakeLanguageCommand.h
cmCMakeMinimumRequired.cxx
cmCMakeMinimumRequired.h
cmCMakePolicyCommand.cxx
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 72c70c2..feb55e8 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 17)
-set(CMake_VERSION_PATCH 20200501)
+set(CMake_VERSION_PATCH 20200525)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CPack/WiX/cmWIXPatchParser.cxx b/Source/CPack/WiX/cmWIXPatchParser.cxx
index 5588d2d..8b26c4e 100644
--- a/Source/CPack/WiX/cmWIXPatchParser.cxx
+++ b/Source/CPack/WiX/cmWIXPatchParser.cxx
@@ -6,7 +6,7 @@
#include <cm/memory>
-#include "cm_expat.h"
+#include <cm3p/expat.h>
#include "cmCPackGenerator.h"
diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx
index aaa5318..967cc60 100644
--- a/Source/CPack/cmCPackArchiveGenerator.cxx
+++ b/Source/CPack/cmCPackArchiveGenerator.cxx
@@ -8,7 +8,7 @@
#include <utility>
#include <vector>
-#include "cm_libarchive.h"
+#include <cm3p/archive.h>
#include "cmCPackComponentGroup.h"
#include "cmCPackGenerator.h"
diff --git a/Source/CPack/cmCPackExternalGenerator.cxx b/Source/CPack/cmCPackExternalGenerator.cxx
index 142eb6f..11e1aec 100644
--- a/Source/CPack/cmCPackExternalGenerator.cxx
+++ b/Source/CPack/cmCPackExternalGenerator.cxx
@@ -8,10 +8,10 @@
#include <cm/memory>
-#include "cmsys/FStream.hxx"
+#include <cm3p/json/value.h>
+#include <cm3p/json/writer.h>
-#include "cm_jsoncpp_value.h"
-#include "cm_jsoncpp_writer.h"
+#include "cmsys/FStream.hxx"
#include "cmCPackComponentGroup.h"
#include "cmCPackLog.h"
diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx
index c87fb83b..c533cd7 100644
--- a/Source/CTest/cmCTestBZR.cxx
+++ b/Source/CTest/cmCTestBZR.cxx
@@ -10,9 +10,9 @@
#include <cmext/algorithm>
-#include "cmsys/RegularExpression.hxx"
+#include <cm3p/expat.h>
-#include "cm_expat.h"
+#include "cmsys/RegularExpression.hxx"
#include "cmCTest.h"
#include "cmCTestVC.h"
diff --git a/Source/CTest/cmCTestCurl.h b/Source/CTest/cmCTestCurl.h
index 9c5ba66..b0d7f07 100644
--- a/Source/CTest/cmCTestCurl.h
+++ b/Source/CTest/cmCTestCurl.h
@@ -8,7 +8,7 @@
#include <string>
#include <vector>
-#include "cm_curl.h"
+#include <cm3p/curl/curl.h>
class cmCTest;
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index b7251d9..a08cb34 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -21,13 +21,13 @@
#include <cm/memory>
#include <cmext/algorithm>
+#include <cm3p/json/value.h>
+#include <cm3p/json/writer.h>
+#include <cm3p/uv.h>
+
#include "cmsys/FStream.hxx"
#include "cmsys/SystemInformation.hxx"
-#include "cm_jsoncpp_value.h"
-#include "cm_jsoncpp_writer.h"
-#include "cm_uv.h"
-
#include "cmAffinity.h"
#include "cmCTest.h"
#include "cmCTestBinPacker.h"
diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h
index 6e999f9..e21b912 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.h
+++ b/Source/CTest/cmCTestMultiProcessHandler.h
@@ -11,10 +11,9 @@
#include <string>
#include <vector>
+#include <cm3p/uv.h>
#include <stddef.h>
-#include "cm_uv.h"
-
#include "cmCTest.h"
#include "cmCTestResourceAllocator.h"
#include "cmCTestTestHandler.h"
diff --git a/Source/CTest/cmCTestResourceSpec.cxx b/Source/CTest/cmCTestResourceSpec.cxx
index 8f91efb..21c97de 100644
--- a/Source/CTest/cmCTestResourceSpec.cxx
+++ b/Source/CTest/cmCTestResourceSpec.cxx
@@ -7,12 +7,12 @@
#include <utility>
#include <vector>
+#include <cm3p/json/reader.h>
+#include <cm3p/json/value.h>
+
#include "cmsys/FStream.hxx"
#include "cmsys/RegularExpression.hxx"
-#include "cm_jsoncpp_reader.h"
-#include "cm_jsoncpp_value.h"
-
static const cmsys::RegularExpression IdentifierRegex{ "^[a-z_][a-z0-9_]*$" };
static const cmsys::RegularExpression IdRegex{ "^[a-z0-9_]+$" };
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 7674d7a..ba7d47e 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -429,6 +429,7 @@ void cmCTestRunTest::StartFailure(std::string const& output,
this->TestResult.Path = this->TestProperties->Directory;
this->TestResult.Output = output;
this->TestResult.FullCommandLine.clear();
+ this->TestResult.Environment.clear();
}
std::string cmCTestRunTest::GetTestPrefix(size_t completed, size_t total) const
@@ -500,6 +501,7 @@ bool cmCTestRunTest::StartTest(size_t completed, size_t total)
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
this->TestResult.Output = "Disabled";
this->TestResult.FullCommandLine.clear();
+ this->TestResult.Environment.clear();
return false;
}
@@ -519,6 +521,7 @@ bool cmCTestRunTest::StartTest(size_t completed, size_t total)
cmCTestLog(this->CTest, HANDLER_OUTPUT, msg << std::endl);
this->TestResult.Output = msg;
this->TestResult.FullCommandLine.clear();
+ this->TestResult.Environment.clear();
this->TestResult.CompletionStatus = "Fixture dependency failed";
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
return false;
@@ -539,6 +542,7 @@ bool cmCTestRunTest::StartTest(size_t completed, size_t total)
cmCTestLog(this->CTest, ERROR_MESSAGE, msg << std::endl);
this->TestResult.Output = msg;
this->TestResult.FullCommandLine.clear();
+ this->TestResult.Environment.clear();
this->TestResult.CompletionStatus = "Missing Configuration";
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
return false;
@@ -554,6 +558,7 @@ bool cmCTestRunTest::StartTest(size_t completed, size_t total)
"Unable to find required file: " << file << std::endl);
this->TestResult.Output = "Unable to find required file: " + file;
this->TestResult.FullCommandLine.clear();
+ this->TestResult.Environment.clear();
this->TestResult.CompletionStatus = "Required Files Missing";
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
return false;
@@ -569,6 +574,7 @@ bool cmCTestRunTest::StartTest(size_t completed, size_t total)
"Unable to find executable: " << args[1] << std::endl);
this->TestResult.Output = "Unable to find executable: " + args[1];
this->TestResult.FullCommandLine.clear();
+ this->TestResult.Environment.clear();
this->TestResult.CompletionStatus = "Unable to find executable";
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
return false;
@@ -713,25 +719,43 @@ bool cmCTestRunTest::ForkProcess(cmDuration testTimeOut, bool explicitTimeout,
cmSystemTools::SaveRestoreEnvironment sre;
#endif
+ std::ostringstream envMeasurement;
if (environment && !environment->empty()) {
cmSystemTools::AppendEnv(*environment);
+ for (auto const& var : *environment) {
+ envMeasurement << var << std::endl;
+ }
}
if (this->UseAllocatedResources) {
- this->SetupResourcesEnvironment();
+ std::vector<std::string> envLog;
+ this->SetupResourcesEnvironment(&envLog);
+ for (auto const& var : envLog) {
+ envMeasurement << var << std::endl;
+ }
} else {
cmSystemTools::UnsetEnv("CTEST_RESOURCE_GROUP_COUNT");
+ // Signify that this variable is being actively unset
+ envMeasurement << "#CTEST_RESOURCE_GROUP_COUNT=" << std::endl;
}
+ this->TestResult.Environment = envMeasurement.str();
+ // Remove last newline
+ this->TestResult.Environment.erase(this->TestResult.Environment.length() -
+ 1);
+
return this->TestProcess->StartProcess(this->MultiTestHandler.Loop,
affinity);
}
-void cmCTestRunTest::SetupResourcesEnvironment()
+void cmCTestRunTest::SetupResourcesEnvironment(std::vector<std::string>* log)
{
std::string processCount = "CTEST_RESOURCE_GROUP_COUNT=";
processCount += std::to_string(this->AllocatedResources.size());
cmSystemTools::PutEnv(processCount);
+ if (log) {
+ log->push_back(processCount);
+ }
std::size_t i = 0;
for (auto const& process : this->AllocatedResources) {
@@ -757,8 +781,14 @@ void cmCTestRunTest::SetupResourcesEnvironment()
var += "id:" + it2.Id + ",slots:" + std::to_string(it2.Slots);
}
cmSystemTools::PutEnv(var);
+ if (log) {
+ log->push_back(var);
+ }
}
cmSystemTools::PutEnv(resourceList);
+ if (log) {
+ log->push_back(resourceList);
+ }
++i;
}
}
diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h
index b1d188a..d831247 100644
--- a/Source/CTest/cmCTestRunTest.h
+++ b/Source/CTest/cmCTestRunTest.h
@@ -119,7 +119,7 @@ private:
// Run post processing of the process output for MemCheck
void MemCheckPostProcess();
- void SetupResourcesEnvironment();
+ void SetupResourcesEnvironment(std::vector<std::string>* log = nullptr);
// Returns "completed/total Test #Index: "
std::string GetTestPrefix(size_t completed, size_t total) const;
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 811a7e8..2989025 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -9,9 +9,9 @@
#include <cmext/algorithm>
-#include "cm_curl.h"
-#include "cm_jsoncpp_reader.h"
-#include "cm_jsoncpp_value.h"
+#include <cm3p/curl/curl.h>
+#include <cm3p/json/reader.h>
+#include <cm3p/json/value.h>
#include "cmAlgorithms.h"
#include "cmCTest.h"
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 8fc5cd6..d0dbaae 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -1432,6 +1432,12 @@ void cmCTestTestHandler::GenerateDartOutput(cmXMLWriter& xml)
xml.Attribute("name", "Command Line");
xml.Element("Value", result.FullCommandLine);
xml.EndElement(); // NamedMeasurement
+
+ xml.StartElement("NamedMeasurement");
+ xml.Attribute("type", "text/string");
+ xml.Attribute("name", "Environment");
+ xml.Element("Value", result.Environment);
+ xml.EndElement(); // NamedMeasurement
for (auto const& measure : result.Properties->Measurements) {
xml.StartElement("NamedMeasurement");
xml.Attribute("type", "text/string");
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 55cecb6..0d88c30 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -169,6 +169,7 @@ public:
std::string Path;
std::string Reason;
std::string FullCommandLine;
+ std::string Environment;
cmDuration ExecutionTime;
std::int64_t ReturnValue;
int Status;
diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx
index 2742fd7..a549117 100644
--- a/Source/CTest/cmProcess.cxx
+++ b/Source/CTest/cmProcess.cxx
@@ -17,7 +17,7 @@
#include "cmGetPipes.h"
#include "cmStringAlgorithms.h"
#if defined(_WIN32)
-# include "cm_kwiml.h"
+# include <cm3p/kwiml/int.h>
#endif
#define CM_PROCESS_BUF_SIZE 65536
diff --git a/Source/CTest/cmProcess.h b/Source/CTest/cmProcess.h
index 526c920..1e6578c 100644
--- a/Source/CTest/cmProcess.h
+++ b/Source/CTest/cmProcess.h
@@ -11,11 +11,10 @@
#include <utility>
#include <vector>
+#include <cm3p/uv.h>
#include <stddef.h>
#include <stdint.h>
-#include "cm_uv.h"
-
#include "cmDuration.h"
#include "cmProcessOutput.h"
#include "cmUVHandlePtr.h"
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx
index 664ba2f..591c546 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.cxx
+++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx
@@ -68,7 +68,7 @@ void cmCursesLongMessageForm::UpdateStatusBar()
bar[i] = ' ';
}
int width;
- if (x < cmCursesMainForm::MAX_WIDTH) {
+ if (x >= 0 && x < cmCursesMainForm::MAX_WIDTH) {
width = x;
} else {
width = cmCursesMainForm::MAX_WIDTH - 1;
diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx
index 4a5c641..8435740 100644
--- a/Source/bindexplib.cxx
+++ b/Source/bindexplib.cxx
@@ -276,8 +276,9 @@ public:
symbol.compare(0, 4, vectorPrefix)) {
SectChar = this->SectionHeaders[pSymbolTable->SectionNumber - 1]
.Characteristics;
- // skip symbols containing a dot
- if (symbol.find('.') == std::string::npos) {
+ // skip symbols containing a dot or are from managed code
+ if (symbol.find('.') == std::string::npos &&
+ !SymbolIsFromManagedCode(symbol)) {
if (!pSymbolTable->Type && (SectChar & IMAGE_SCN_MEM_WRITE)) {
// Read only (i.e. constants) must be excluded
this->DataSymbols.insert(symbol);
@@ -302,6 +303,13 @@ public:
}
private:
+ bool SymbolIsFromManagedCode(std::string const& symbol)
+ {
+ return symbol == "__t2m" || symbol == "__m2mep" || symbol == "__mep" ||
+ symbol.find("$$F") != std::string::npos ||
+ symbol.find("$$J") != std::string::npos;
+ }
+
std::set<std::string>& Symbols;
std::set<std::string>& DataSymbols;
DWORD_PTR SymbolCount;
diff --git a/Source/cmAffinity.cxx b/Source/cmAffinity.cxx
index 8f9fe2a..35443e7 100644
--- a/Source/cmAffinity.cxx
+++ b/Source/cmAffinity.cxx
@@ -2,7 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmAffinity.h"
-#include "cm_uv.h"
+#include <cm3p/uv.h>
#ifndef CMAKE_USE_SYSTEM_LIBUV
# ifdef _WIN32
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index 8b0aa5e..c8e8dcb 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -15,8 +15,6 @@
#include <cmext/algorithm>
-#include "cm_kwiml.h"
-
#include "cmRange.h"
template <typename FwdIt>
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index 0f9b42c..78bb6e0 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -7,12 +7,14 @@
#include <iostream>
#include <sstream>
+#include <cm3p/archive.h>
+#include <cm3p/archive_entry.h>
+
#include "cmsys/Directory.hxx"
#include "cmsys/Encoding.hxx"
#include "cmsys/FStream.hxx"
#include "cm_get_date.h"
-#include "cm_libarchive.h"
#include "cmLocale.h"
#include "cmStringAlgorithms.h"
diff --git a/Source/cmCMakeCommand.cxx b/Source/cmCMakeCommand.cxx
deleted file mode 100644
index c11a003..0000000
--- a/Source/cmCMakeCommand.cxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmCMakeCommand.h"
-
-#include <algorithm>
-#include <cstddef>
-
-#include "cmExecutionStatus.h"
-#include "cmListFileCache.h"
-#include "cmMakefile.h"
-#include "cmRange.h"
-#include "cmStringAlgorithms.h"
-
-bool cmCMakeCommand(std::vector<std::string> const& args,
- cmExecutionStatus& status)
-{
- if (args.empty()) {
- status.SetError("called with incorrect number of arguments");
- return false;
- }
-
- cmMakefile& makefile = status.GetMakefile();
- cmListFileContext context = makefile.GetExecutionContext();
-
- bool result = false;
-
- if (args[0] == "INVOKE") {
- if (args.size() == 1) {
- status.SetError("called with incorrect number of arguments");
- return false;
- }
-
- // First argument is the name of the function to call
- cmListFileFunction func;
- func.Name = args[1];
- func.Line = context.Line;
-
- // The rest of the arguments are passed to the function call above
- func.Arguments.resize(args.size() - 1);
- for (size_t i = 2; i < args.size(); ++i) {
- cmListFileArgument lfarg;
- lfarg.Line = context.Line;
- lfarg.Value = args[i];
- func.Arguments.emplace_back(lfarg);
- }
-
- result = makefile.ExecuteCommand(func, status);
- } else if (args[0] == "EVAL") {
- if (args.size() < 2) {
- status.SetError("called with incorrect number of arguments");
- return false;
- }
-
- auto code_iter = std::find(args.begin(), args.end(), "CODE");
- if (code_iter == args.end()) {
- status.SetError("called without CODE argument");
- return false;
- }
-
- const std::string code = cmJoin(cmMakeRange(++code_iter, args.end()), " ");
- result = makefile.ReadListFileAsString(
- code, cmStrCat(context.FilePath, ":", context.Line, ":EVAL"));
- } else {
- status.SetError("called with unknown meta-operation");
- }
-
- return result;
-}
diff --git a/Source/cmCMakeLanguageCommand.cxx b/Source/cmCMakeLanguageCommand.cxx
new file mode 100644
index 0000000..66857be
--- /dev/null
+++ b/Source/cmCMakeLanguageCommand.cxx
@@ -0,0 +1,111 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#include "cmCMakeLanguageCommand.h"
+
+#include <algorithm>
+#include <cstddef>
+#include <memory>
+#include <string>
+
+#include "cmExecutionStatus.h"
+#include "cmListFileCache.h"
+#include "cmMakefile.h"
+#include "cmRange.h"
+#include "cmStringAlgorithms.h"
+
+bool cmCMakeLanguageCommand(std::vector<cmListFileArgument> const& args,
+ cmExecutionStatus& status)
+{
+ if (args.empty()) {
+ status.SetError("called with incorrect number of arguments");
+ return false;
+ }
+
+ cmMakefile& makefile = status.GetMakefile();
+ cmListFileContext context = makefile.GetExecutionContext();
+
+ bool result = false;
+
+ std::vector<std::string> dispatchExpandedArgs;
+ std::vector<cmListFileArgument> dispatchArgs;
+ dispatchArgs.emplace_back(args[0]);
+ makefile.ExpandArguments(dispatchArgs, dispatchExpandedArgs);
+
+ if (dispatchExpandedArgs.empty()) {
+ status.SetError("called with incorrect number of arguments");
+ return false;
+ }
+
+ if (dispatchExpandedArgs[0] == "CALL") {
+ if ((args.size() == 1 && dispatchExpandedArgs.size() != 2) ||
+ dispatchExpandedArgs.size() > 2) {
+ status.SetError("called with incorrect number of arguments");
+ return false;
+ }
+
+ // First argument is the name of the function to call
+ std::string callCommand;
+ size_t startArg;
+ if (dispatchExpandedArgs.size() == 1) {
+ std::vector<std::string> functionExpandedArg;
+ std::vector<cmListFileArgument> functionArg;
+ functionArg.emplace_back(args[1]);
+ makefile.ExpandArguments(functionArg, functionExpandedArg);
+
+ if (functionExpandedArg.size() != 1) {
+ status.SetError("called with incorrect number of arguments");
+ return false;
+ }
+
+ callCommand = functionExpandedArg[0];
+ startArg = 2;
+ } else {
+ callCommand = dispatchExpandedArgs[1];
+ startArg = 1;
+ }
+
+ cmListFileFunction func;
+ func.Name = callCommand;
+ func.Line = context.Line;
+
+ // The rest of the arguments are passed to the function call above
+ for (size_t i = startArg; i < args.size(); ++i) {
+ cmListFileArgument lfarg;
+ lfarg.Delim = args[i].Delim;
+ lfarg.Line = context.Line;
+ lfarg.Value = args[i].Value;
+ func.Arguments.emplace_back(lfarg);
+ }
+
+ result = makefile.ExecuteCommand(func, status);
+ } else if (dispatchExpandedArgs[0] == "EVAL") {
+ std::vector<std::string> expandedArgs;
+ makefile.ExpandArguments(args, expandedArgs);
+
+ if (expandedArgs.size() < 2) {
+ status.SetError("called with incorrect number of arguments");
+ return false;
+ }
+
+ if (expandedArgs[1] != "CODE") {
+ auto code_iter =
+ std::find(expandedArgs.begin() + 2, expandedArgs.end(), "CODE");
+ if (code_iter == expandedArgs.end()) {
+ status.SetError("called without CODE argument");
+ } else {
+ status.SetError(
+ "called with unsupported arguments between EVAL and CODE arguments");
+ }
+ return false;
+ }
+
+ const std::string code =
+ cmJoin(cmMakeRange(expandedArgs.begin() + 2, expandedArgs.end()), " ");
+ result = makefile.ReadListFileAsString(
+ code, cmStrCat(context.FilePath, ":", context.Line, ":EVAL"));
+ } else {
+ status.SetError("called with unknown meta-operation");
+ }
+
+ return result;
+}
diff --git a/Source/cmCMakeCommand.h b/Source/cmCMakeLanguageCommand.h
index cf9f4c3..7306515 100644
--- a/Source/cmCMakeCommand.h
+++ b/Source/cmCMakeLanguageCommand.h
@@ -1,20 +1,20 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCMakeCommand_h
-#define cmCMakeCommand_h
+#ifndef cmCMakeLanguageCommand_h
+#define cmCMakeLanguageCommand_h
#include "cmConfigure.h" // IWYU pragma: keep
-#include <string>
#include <vector>
class cmExecutionStatus;
+struct cmListFileArgument;
/**
* \brief Calls a scripted or build-in command
*
*/
-bool cmCMakeCommand(std::vector<std::string> const& args,
- cmExecutionStatus& status);
+bool cmCMakeLanguageCommand(std::vector<cmListFileArgument> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 2a0ddba1..9b023d9 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -21,6 +21,9 @@
#include <cmext/algorithm>
#include <cmext/string_view>
+#include <cm3p/curl/curl.h>
+#include <cm3p/zlib.h>
+
#include "cmsys/Base64.h"
#include "cmsys/Directory.hxx"
#include "cmsys/FStream.hxx"
@@ -28,9 +31,6 @@
#include "cmsys/Process.h"
#include "cmsys/RegularExpression.hxx"
#include "cmsys/SystemInformation.hxx"
-
-#include "cm_curl.h"
-#include "cm_zlib.h"
#if defined(_WIN32)
# include <windows.h> // IWYU pragma: keep
#else
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index 28b4267..c94f128 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -91,8 +91,8 @@
# include "cmAddLinkOptionsCommand.h"
# include "cmAuxSourceDirectoryCommand.h"
# include "cmBuildNameCommand.h"
-# include "cmCMakeCommand.h"
# include "cmCMakeHostSystemInformationCommand.h"
+# include "cmCMakeLanguageCommand.h"
# include "cmExportCommand.h"
# include "cmExportLibraryDependenciesCommand.h"
# include "cmFLTKWrapUICommand.h"
@@ -197,9 +197,9 @@ void GetScriptingCommands(cmState* state)
"match the opening WHILE command.");
#if !defined(CMAKE_BOOTSTRAP)
- state->AddBuiltinCommand("cmake_command", cmCMakeCommand);
state->AddBuiltinCommand("cmake_host_system_information",
cmCMakeHostSystemInformationCommand);
+ state->AddBuiltinCommand("cmake_language", cmCMakeLanguageCommand);
state->AddBuiltinCommand("load_cache", cmLoadCacheCommand);
state->AddBuiltinCommand("remove", cmRemoveCommand);
state->AddBuiltinCommand("variable_watch", cmVariableWatchCommand);
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 5414409..32a33ee 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -98,6 +98,34 @@ void cmCommonTargetGenerator::AppendFortranFormatFlags(
}
}
+void cmCommonTargetGenerator::AppendFortranPreprocessFlags(
+ std::string& flags, cmSourceFile const& source)
+{
+ const std::string srcpp = source.GetSafeProperty("Fortran_PREPROCESS");
+ cmOutputConverter::FortranPreprocess preprocess =
+ cmOutputConverter::GetFortranPreprocess(srcpp);
+ if (preprocess == cmOutputConverter::FortranPreprocess::Unset) {
+ std::string const& tgtpp =
+ this->GeneratorTarget->GetSafeProperty("Fortran_PREPROCESS");
+ preprocess = cmOutputConverter::GetFortranPreprocess(tgtpp);
+ }
+ const char* var = nullptr;
+ switch (preprocess) {
+ case cmOutputConverter::FortranPreprocess::Needed:
+ var = "CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON";
+ break;
+ case cmOutputConverter::FortranPreprocess::NotNeeded:
+ var = "CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF";
+ break;
+ default:
+ break;
+ }
+ if (var) {
+ this->LocalCommonGenerator->AppendCompileOptions(
+ flags, this->Makefile->GetSafeDefinition(var));
+ }
+}
+
std::string cmCommonTargetGenerator::GetFlags(const std::string& l,
const std::string& config,
const std::string& arch)
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index 78cedf5..c3c3a3a 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -45,6 +45,9 @@ protected:
void AppendFortranFormatFlags(std::string& flags,
cmSourceFile const& source);
+ void AppendFortranPreprocessFlags(std::string& flags,
+ cmSourceFile const& source);
+
virtual void AddIncludeFlags(std::string& flags, std::string const& lang,
const std::string& config) = 0;
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index ea7ede4..8723d08 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -12,7 +12,6 @@
#include <cmext/algorithm>
#include "cmComputeLinkDepends.h"
-#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmListFileCache.h"
@@ -587,32 +586,18 @@ void cmComputeLinkInformation::AddImplicitLinkInfo()
}
void cmComputeLinkInformation::AddRuntimeLinkLibrary(std::string const& lang)
-{ // Add the lang runtime library flags. This is activated by the presence
- // of a default selection whether or not it is overridden by a property.
- std::string defaultVar =
- cmStrCat("CMAKE_", lang, "_RUNTIME_LIBRARY_DEFAULT");
- cmProp langRuntimeLibraryDefault = this->Makefile->GetDef(defaultVar);
- if (langRuntimeLibraryDefault && !langRuntimeLibraryDefault->empty()) {
- cmProp runtimeLibraryValue =
- this->Target->GetProperty(cmStrCat(lang, "_RUNTIME_LIBRARY"));
- if (!runtimeLibraryValue) {
- runtimeLibraryValue = langRuntimeLibraryDefault;
- }
-
- std::string runtimeLibrary =
- cmSystemTools::UpperCase(cmGeneratorExpression::Evaluate(
- *runtimeLibraryValue, this->Target->GetLocalGenerator(), this->Config,
- this->Target));
- if (!runtimeLibrary.empty()) {
- if (const char* runtimeLinkOptions = this->Makefile->GetDefinition(
- "CMAKE_" + lang + "_RUNTIME_LIBRARY_LINK_OPTIONS_" +
- runtimeLibrary)) {
- std::vector<std::string> libsVec = cmExpandedList(runtimeLinkOptions);
- for (std::string const& i : libsVec) {
- if (!cm::contains(this->ImplicitLinkLibs, i)) {
- this->AddItem(i, nullptr);
- }
- }
+{
+ std::string const& runtimeLibrary =
+ this->Target->GetRuntimeLinkLibrary(lang, this->Config);
+ if (runtimeLibrary.empty()) {
+ return;
+ }
+ if (const char* runtimeLinkOptions = this->Makefile->GetDefinition(
+ "CMAKE_" + lang + "_RUNTIME_LIBRARY_LINK_OPTIONS_" + runtimeLibrary)) {
+ std::vector<std::string> libsVec = cmExpandedList(runtimeLinkOptions);
+ for (std::string const& i : libsVec) {
+ if (!cm::contains(this->ImplicitLinkLibs, i)) {
+ this->AddItem(i, nullptr);
}
}
}
diff --git a/Source/cmConnection.cxx b/Source/cmConnection.cxx
index 884e314..e4d0cf1 100644
--- a/Source/cmConnection.cxx
+++ b/Source/cmConnection.cxx
@@ -5,7 +5,7 @@
#include <cassert>
#include <cstring>
-#include "cm_uv.h"
+#include <cm3p/uv.h>
#include "cmServer.h"
@@ -20,8 +20,13 @@ void cmEventBasedConnection::on_alloc_buffer(uv_handle_t* handle,
uv_buf_t* buf)
{
(void)(handle);
+#ifndef __clang_analyzer__
char* rawBuffer = new char[suggested_size];
*buf = uv_buf_init(rawBuffer, static_cast<unsigned int>(suggested_size));
+#else
+ (void)(suggested_size);
+ (void)(buf);
+#endif /* __clang_analyzer__ */
}
void cmEventBasedConnection::on_read(uv_stream_t* stream, ssize_t nread,
@@ -76,6 +81,7 @@ void cmEventBasedConnection::WriteData(const std::string& _data)
assert(uv_thread_equal(&curr_thread_id, &this->Server->ServeThreadId));
#endif
+#ifndef __clang_analyzer__
auto data = _data;
assert(this->WriteStream.get());
if (BufferStrategy) {
@@ -90,6 +96,9 @@ void cmEventBasedConnection::WriteData(const std::string& _data)
memcpy(req->buf.base, data.c_str(), ds);
uv_write(reinterpret_cast<uv_write_t*>(req), this->WriteStream, &req->buf, 1,
on_write);
+#else
+ (void)(_data);
+#endif /* __clang_analyzer__ */
}
void cmEventBasedConnection::ReadData(const std::string& data)
diff --git a/Source/cmConnection.h b/Source/cmConnection.h
index 7bb2494..5335a7f 100644
--- a/Source/cmConnection.h
+++ b/Source/cmConnection.h
@@ -9,7 +9,7 @@
#include <memory>
#include <string>
-#include "cm_uv.h"
+#include <cm3p/uv.h>
#include "cmUVHandlePtr.h"
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 4e2caed..cc2cd01 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -44,6 +44,8 @@ static std::string const kCMAKE_CUDA_ARCHITECTURES =
"CMAKE_CUDA_ARCHITECTURES";
static std::string const kCMAKE_CUDA_COMPILER_TARGET =
"CMAKE_CUDA_COMPILER_TARGET";
+static std::string const kCMAKE_CUDA_RUNTIME_LIBRARY =
+ "CMAKE_CUDA_RUNTIME_LIBRARY";
static std::string const kCMAKE_ENABLE_EXPORTS = "CMAKE_ENABLE_EXPORTS";
static std::string const kCMAKE_LINK_SEARCH_END_STATIC =
"CMAKE_LINK_SEARCH_END_STATIC";
@@ -717,6 +719,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
vars.insert(kCMAKE_CXX_COMPILER_TARGET);
vars.insert(kCMAKE_CUDA_ARCHITECTURES);
vars.insert(kCMAKE_CUDA_COMPILER_TARGET);
+ vars.insert(kCMAKE_CUDA_RUNTIME_LIBRARY);
vars.insert(kCMAKE_ENABLE_EXPORTS);
vars.insert(kCMAKE_LINK_SEARCH_END_STATIC);
vars.insert(kCMAKE_LINK_SEARCH_START_STATIC);
diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx
index dc7d939..b1e63ba 100644
--- a/Source/cmCryptoHash.cxx
+++ b/Source/cmCryptoHash.cxx
@@ -4,10 +4,10 @@
#include <cm/memory>
-#include "cmsys/FStream.hxx"
+#include <cm3p/kwiml/int.h>
+#include <cm3p/rhash.h>
-#include "cm_kwiml.h"
-#include "cm_rhash.h"
+#include "cmsys/FStream.hxx"
static unsigned int const cmCryptoHashAlgoToId[] = {
/* clang-format needs this comment to break after the opening brace */
diff --git a/Source/cmCurl.h b/Source/cmCurl.h
index cb73ce6..7bd036e 100644
--- a/Source/cmCurl.h
+++ b/Source/cmCurl.h
@@ -7,7 +7,7 @@
#include <string>
-#include "cm_curl.h"
+#include <cm3p/curl/curl.h>
std::string cmCurlSetCAInfo(::CURL* curl, const char* cafile = nullptr);
std::string cmCurlSetNETRCOption(::CURL* curl, const std::string& netrc_level,
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index 202b205..a8d81f7 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -3,6 +3,7 @@
#include "cmELF.h"
#include <cstddef>
+#include <cstdint>
#include <map>
#include <memory>
#include <sstream>
@@ -12,14 +13,13 @@
#include <cm/memory>
#include <cmext/algorithm>
-#include "cmsys/FStream.hxx"
+#include <cm3p/kwiml/abi.h>
-#include "cm_kwiml.h"
+#include "cmsys/FStream.hxx"
// Include the ELF format information system header.
#if defined(__OpenBSD__)
# include <elf_abi.h>
-# include <stdint.h>
#elif defined(__HAIKU__)
# include <elf32.h>
# include <elf64.h>
diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx
index 0ee1259..3641cb2 100644
--- a/Source/cmExportBuildAndroidMKGenerator.cxx
+++ b/Source/cmExportBuildAndroidMKGenerator.cxx
@@ -47,7 +47,9 @@ void cmExportBuildAndroidMKGenerator::GenerateImportTargetCode(
os << "LOCAL_MODULE := ";
os << targetName << "\n";
os << "LOCAL_SRC_FILES := ";
- std::string path = cmSystemTools::ConvertToOutputPath(target->GetFullPath());
+ std::string const noConfig; // FIXME: What config to use here?
+ std::string path =
+ cmSystemTools::ConvertToOutputPath(target->GetFullPath(noConfig));
os << path << "\n";
}
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 28037c6..ed0689a 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -923,12 +923,14 @@ void cmExportFileGenerator::GeneratePolicyHeaderCode(std::ostream& os)
/* clang-format on */
// Isolate the file policy level.
- // We use 2.6 here instead of the current version because newer
- // versions of CMake should be able to export files imported by 2.6
- // until the import format changes.
+ // Support CMake versions as far back as 2.6 but also support using NEW
+ // policy settings for up to CMake 3.17 (this upper limit may be reviewed
+ // and increased from time to time). This reduces the opportunity for CMake
+ // warnings when an older export file is later used with newer CMake
+ // versions.
/* clang-format off */
os << "cmake_policy(PUSH)\n"
- << "cmake_policy(VERSION 2.6)\n";
+ << "cmake_policy(VERSION 2.6...3.17)\n";
/* clang-format on */
}
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index 6212667..46056c1 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -71,7 +71,7 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
cmTarget dummyHead("try_compile_dummy_exe", cmStateEnums::EXECUTABLE,
cmTarget::VisibilityNormal, tgt->Target->GetMakefile(),
- true);
+ cmTarget::PerConfig::Yes);
cmGeneratorTarget gDummyHead(&dummyHead, tgt->GetLocalGenerator());
diff --git a/Source/cmExprParserHelper.h b/Source/cmExprParserHelper.h
index eaf5dc7..717acdc 100644
--- a/Source/cmExprParserHelper.h
+++ b/Source/cmExprParserHelper.h
@@ -8,7 +8,7 @@
#include <string>
#include <vector>
-#include "cm_kwiml.h"
+#include <cm3p/kwiml/int.h>
class cmExprParserHelper
{
diff --git a/Source/cmFileAPI.h b/Source/cmFileAPI.h
index e183e0d..ae07612 100644
--- a/Source/cmFileAPI.h
+++ b/Source/cmFileAPI.h
@@ -11,9 +11,9 @@
#include <unordered_set>
#include <vector>
-#include "cm_jsoncpp_reader.h"
-#include "cm_jsoncpp_value.h"
-#include "cm_jsoncpp_writer.h"
+#include <cm3p/json/reader.h>
+#include <cm3p/json/value.h>
+#include <cm3p/json/writer.h>
class cmake;
diff --git a/Source/cmFileAPICMakeFiles.cxx b/Source/cmFileAPICMakeFiles.cxx
index 44ba96c..1e4f3b6 100644
--- a/Source/cmFileAPICMakeFiles.cxx
+++ b/Source/cmFileAPICMakeFiles.cxx
@@ -6,7 +6,7 @@
#include <string>
#include <vector>
-#include "cm_jsoncpp_value.h"
+#include <cm3p/json/value.h>
#include "cmFileAPI.h"
#include "cmGlobalGenerator.h"
diff --git a/Source/cmFileAPICMakeFiles.h b/Source/cmFileAPICMakeFiles.h
index a851c32..1ae1e4f 100644
--- a/Source/cmFileAPICMakeFiles.h
+++ b/Source/cmFileAPICMakeFiles.h
@@ -5,7 +5,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#include "cm_jsoncpp_value.h"
+#include <cm3p/json/value.h>
class cmFileAPI;
diff --git a/Source/cmFileAPICache.cxx b/Source/cmFileAPICache.cxx
index 5d2ddf9..25e5916 100644
--- a/Source/cmFileAPICache.cxx
+++ b/Source/cmFileAPICache.cxx
@@ -7,7 +7,7 @@
#include <utility>
#include <vector>
-#include "cm_jsoncpp_value.h"
+#include <cm3p/json/value.h>
#include "cmFileAPI.h"
#include "cmState.h"
diff --git a/Source/cmFileAPICache.h b/Source/cmFileAPICache.h
index 09d9e1c..2f30c76 100644
--- a/Source/cmFileAPICache.h
+++ b/Source/cmFileAPICache.h
@@ -5,7 +5,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#include "cm_jsoncpp_value.h"
+#include <cm3p/json/value.h>
class cmFileAPI;
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 26beebf..b7daebe 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -17,7 +17,7 @@
#include <cmext/algorithm>
-#include "cm_jsoncpp_value.h"
+#include <cm3p/json/value.h>
#include "cmCryptoHash.h"
#include "cmFileAPI.h"
diff --git a/Source/cmFileAPICodemodel.h b/Source/cmFileAPICodemodel.h
index ffbd928..a6c6bdd 100644
--- a/Source/cmFileAPICodemodel.h
+++ b/Source/cmFileAPICodemodel.h
@@ -5,7 +5,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#include "cm_jsoncpp_value.h"
+#include <cm3p/json/value.h>
class cmFileAPI;
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 161bbe8..268c5d1 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -19,11 +19,12 @@
#include <cmext/algorithm>
#include <cmext/string_view>
+#include <cm3p/kwiml/int.h>
+
#include "cmsys/FStream.hxx"
#include "cmsys/Glob.hxx"
#include "cmsys/RegularExpression.hxx"
-#include "cm_kwiml.h"
#include "cm_sys_stat.h"
#include "cmAlgorithms.h"
@@ -54,7 +55,7 @@
#include "cmake.h"
#if !defined(CMAKE_BOOTSTRAP)
-# include "cm_curl.h"
+# include <cm3p/curl/curl.h>
# include "cmCurl.h"
# include "cmFileLockResult.h"
@@ -676,12 +677,12 @@ bool HandleGlobImpl(std::vector<std::string> const& args, bool recurse,
}
}
+ cmake* cm = status.GetMakefile().GetCMakeInstance();
std::vector<std::string> files;
bool configureDepends = false;
bool warnConfigureLate = false;
bool warnFollowedSymlinks = false;
- const cmake::WorkingMode workingMode =
- status.GetMakefile().GetCMakeInstance()->GetWorkingMode();
+ const cmake::WorkingMode workingMode = cm->GetWorkingMode();
while (i != args.end()) {
if (*i == "LIST_DIRECTORIES") {
++i; // skip LIST_DIRECTORIES
@@ -769,12 +770,17 @@ bool HandleGlobImpl(std::vector<std::string> const& args, bool recurse,
MessageType::AUTHOR_WARNING,
"Cyclic recursion detected while globbing for '" + *i + "':\n" +
globMessage.content);
- } else {
+ } else if (globMessage.type == cmsys::Glob::error) {
status.GetMakefile().IssueMessage(
MessageType::FATAL_ERROR,
"Error has occurred while globbing for '" + *i + "' - " +
globMessage.content);
shouldExit = true;
+ } else if (cm->GetDebugOutput() || cm->GetTrace()) {
+ status.GetMakefile().IssueMessage(
+ MessageType::LOG,
+ cmStrCat("Globbing for\n ", *i, "\nEncountered an error:\n ",
+ globMessage.content));
}
}
if (shouldExit) {
@@ -794,7 +800,7 @@ bool HandleGlobImpl(std::vector<std::string> const& args, bool recurse,
std::sort(foundFiles.begin(), foundFiles.end());
foundFiles.erase(std::unique(foundFiles.begin(), foundFiles.end()),
foundFiles.end());
- status.GetMakefile().GetCMakeInstance()->AddGlobCacheEntry(
+ cm->AddGlobCacheEntry(
recurse, (recurse ? g.GetRecurseListDirs() : g.GetListDirs()),
(recurse ? g.GetRecurseThroughSymlinks() : false),
(g.GetRelative() ? g.GetRelative() : ""), expr, foundFiles, variable,
diff --git a/Source/cmFileMonitor.h b/Source/cmFileMonitor.h
index b510a2c..fc75b0c 100644
--- a/Source/cmFileMonitor.h
+++ b/Source/cmFileMonitor.h
@@ -9,7 +9,7 @@
#include <string>
#include <vector>
-#include "cm_uv.h"
+#include <cm3p/uv.h>
class cmRootWatcher;
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index ae9ade7..7058a54 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -12,7 +12,7 @@
#include <string>
#include <vector>
-#include "cm_kwiml.h"
+#include <cm3p/kwiml/int.h>
#include "cmFindCommon.h"
#include "cmPolicies.h"
diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx
index f76e205..9cee0e6 100644
--- a/Source/cmGeneratedFileStream.cxx
+++ b/Source/cmGeneratedFileStream.cxx
@@ -8,8 +8,9 @@
#include "cmSystemTools.h"
#if !defined(CMAKE_BOOTSTRAP)
+# include <cm3p/zlib.h>
+
# include "cm_codecvt.hxx"
-# include "cm_zlib.h"
#endif
cmGeneratedFileStream::cmGeneratedFileStream(Encoding encoding)
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 62427f6..f2a51ab 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -238,17 +238,23 @@ EvaluatedTargetPropertyEntry EvaluateTargetPropertyEntry(
return ee;
}
-std::vector<EvaluatedTargetPropertyEntry> EvaluateTargetPropertyEntries(
+struct EvaluatedTargetPropertyEntries
+{
+ std::vector<EvaluatedTargetPropertyEntry> Entries;
+ bool HadContextSensitiveCondition = false;
+};
+
+EvaluatedTargetPropertyEntries EvaluateTargetPropertyEntries(
cmGeneratorTarget const* thisTarget, std::string const& config,
std::string const& lang, cmGeneratorExpressionDAGChecker* dagChecker,
std::vector<std::unique_ptr<cmGeneratorTarget::TargetPropertyEntry>> const&
in)
{
- std::vector<EvaluatedTargetPropertyEntry> out;
- out.reserve(in.size());
+ EvaluatedTargetPropertyEntries out;
+ out.Entries.reserve(in.size());
for (auto& entry : in) {
- out.emplace_back(EvaluateTargetPropertyEntry(thisTarget, config, lang,
- dagChecker, *entry));
+ out.Entries.emplace_back(EvaluateTargetPropertyEntry(
+ thisTarget, config, lang, dagChecker, *entry));
}
return out;
}
@@ -687,6 +693,7 @@ const char* cmGeneratorTarget::GetFileSuffixInternal(
void cmGeneratorTarget::ClearSourcesCache()
{
+ this->AllConfigSources.clear();
this->KindedSourcesMap.clear();
this->LinkImplementationLanguageIsContextDependent = true;
this->Objects.clear();
@@ -969,51 +976,12 @@ void cmGeneratorTarget::GetExternalObjects(
IMPLEMENT_VISIT(SourceKindExternalObject);
}
-void cmGeneratorTarget::GetExpectedResxHeaders(std::set<std::string>& headers,
- const std::string& config) const
-{
- KindedSources const& kinded = this->GetKindedSources(config);
- headers = kinded.ExpectedResxHeaders;
-}
-
-void cmGeneratorTarget::GetResxSources(std::vector<cmSourceFile const*>& data,
- const std::string& config) const
-{
- IMPLEMENT_VISIT(SourceKindResx);
-}
-
-void cmGeneratorTarget::GetAppManifest(std::vector<cmSourceFile const*>& data,
- const std::string& config) const
-{
- IMPLEMENT_VISIT(SourceKindAppManifest);
-}
-
void cmGeneratorTarget::GetManifests(std::vector<cmSourceFile const*>& data,
const std::string& config) const
{
IMPLEMENT_VISIT(SourceKindManifest);
}
-void cmGeneratorTarget::GetCertificates(std::vector<cmSourceFile const*>& data,
- const std::string& config) const
-{
- IMPLEMENT_VISIT(SourceKindCertificate);
-}
-
-void cmGeneratorTarget::GetExpectedXamlHeaders(std::set<std::string>& headers,
- const std::string& config) const
-{
- KindedSources const& kinded = this->GetKindedSources(config);
- headers = kinded.ExpectedXamlHeaders;
-}
-
-void cmGeneratorTarget::GetExpectedXamlSources(std::set<std::string>& srcs,
- const std::string& config) const
-{
- KindedSources const& kinded = this->GetKindedSources(config);
- srcs = kinded.ExpectedXamlSources;
-}
-
std::set<cmLinkItem> const& cmGeneratorTarget::GetUtilityItems() const
{
if (!this->UtilityItemsDone) {
@@ -1033,12 +1001,6 @@ std::set<cmLinkItem> const& cmGeneratorTarget::GetUtilityItems() const
return this->UtilityItems;
}
-void cmGeneratorTarget::GetXamlSources(std::vector<cmSourceFile const*>& data,
- const std::string& config) const
-{
- IMPLEMENT_VISIT(SourceKindXaml);
-}
-
const std::string& cmGeneratorTarget::GetLocation(
const std::string& config) const
{
@@ -1090,7 +1052,8 @@ const std::string& cmGeneratorTarget::GetLocationForBuild() const
}
// Now handle the deprecated build-time configuration location.
- location = this->GetDirectory();
+ std::string const noConfig;
+ location = this->GetDirectory(noConfig);
const char* cfgid = this->Makefile->GetDefinition("CMAKE_CFG_INTDIR");
if (cfgid && strcmp(cfgid, ".") != 0) {
location += "/";
@@ -1246,6 +1209,9 @@ std::string cmGeneratorTarget::EvaluateInterfaceProperty(
if (cmLinkInterfaceLibraries const* iface = this->GetLinkInterfaceLibraries(
context->Config, headTarget, usage_requirements_only)) {
+ context->HadContextSensitiveCondition =
+ context->HadContextSensitiveCondition ||
+ iface->HadContextSensitiveCondition;
for (cmLinkItem const& lib : iface->Libraries) {
// Broken code can have a target in its own link interface.
// Don't follow such link interface entries so as not to create a
@@ -1333,7 +1299,7 @@ std::string AddSwiftInterfaceIncludeDirectories(
void AddSwiftImplicitIncludeDirectories(
const cmGeneratorTarget* target, const std::string& config,
- std::vector<EvaluatedTargetPropertyEntry>& entries)
+ EvaluatedTargetPropertyEntries& entries)
{
if (const auto* libraries = target->GetLinkImplementationLibraries(config)) {
cmGeneratorExpressionDAGChecker dag{ target->GetBacktrace(), target,
@@ -1357,7 +1323,7 @@ void AddSwiftImplicitIncludeDirectories(
config, &dag),
entry.Values);
- entries.emplace_back(std::move(entry));
+ entries.Entries.emplace_back(std::move(entry));
}
}
}
@@ -1368,11 +1334,12 @@ void AddInterfaceEntries(cmGeneratorTarget const* headTarget,
std::string const& config, std::string const& prop,
std::string const& lang,
cmGeneratorExpressionDAGChecker* dagChecker,
- std::vector<EvaluatedTargetPropertyEntry>& entries,
+ EvaluatedTargetPropertyEntries& entries,
bool usage_requirements_only = true)
{
if (cmLinkImplementationLibraries const* impl =
headTarget->GetLinkImplementationLibraries(config)) {
+ entries.HadContextSensitiveCondition = impl->HadContextSensitiveCondition;
for (cmLinkImplItem const& lib : impl->Libraries) {
if (lib.Target) {
EvaluatedTargetPropertyEntry ee(lib, lib.Backtrace);
@@ -1386,7 +1353,7 @@ void AddInterfaceEntries(cmGeneratorTarget const* headTarget,
prop, &context, dagChecker, usage_requirements_only),
ee.Values);
ee.ContextDependent = context.HadContextSensitiveCondition;
- entries.emplace_back(std::move(ee));
+ entries.Entries.emplace_back(std::move(ee));
}
}
}
@@ -1395,10 +1362,11 @@ void AddInterfaceEntries(cmGeneratorTarget const* headTarget,
void AddObjectEntries(cmGeneratorTarget const* headTarget,
std::string const& config,
cmGeneratorExpressionDAGChecker* dagChecker,
- std::vector<EvaluatedTargetPropertyEntry>& entries)
+ EvaluatedTargetPropertyEntries& entries)
{
if (cmLinkImplementationLibraries const* impl =
headTarget->GetLinkImplementationLibraries(config)) {
+ entries.HadContextSensitiveCondition = impl->HadContextSensitiveCondition;
for (cmLinkImplItem const& lib : impl->Libraries) {
if (lib.Target &&
lib.Target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
@@ -1417,23 +1385,23 @@ void AddObjectEntries(cmGeneratorTarget const* headTarget,
if (cge->GetHadContextSensitiveCondition()) {
ee.ContextDependent = true;
}
- entries.emplace_back(std::move(ee));
+ entries.Entries.emplace_back(std::move(ee));
}
}
}
}
bool processSources(cmGeneratorTarget const* tgt,
- std::vector<EvaluatedTargetPropertyEntry>& entries,
+ EvaluatedTargetPropertyEntries& entries,
std::vector<BT<std::string>>& srcs,
std::unordered_set<std::string>& uniqueSrcs,
bool debugSources)
{
cmMakefile* mf = tgt->Target->GetMakefile();
- bool contextDependent = false;
+ bool contextDependent = entries.HadContextSensitiveCondition;
- for (EvaluatedTargetPropertyEntry& entry : entries) {
+ for (EvaluatedTargetPropertyEntry& entry : entries.Entries) {
if (entry.ContextDependent) {
contextDependent = true;
}
@@ -1534,16 +1502,15 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
cmGeneratorExpressionDAGChecker dagChecker(this, "SOURCES", nullptr,
nullptr);
- std::vector<EvaluatedTargetPropertyEntry> entries =
- EvaluateTargetPropertyEntries(this, config, std::string(), &dagChecker,
- this->SourceEntries);
+ EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
+ this, config, std::string(), &dagChecker, this->SourceEntries);
std::unordered_set<std::string> uniqueSrcs;
bool contextDependentDirectSources =
processSources(this, entries, files, uniqueSrcs, debugSources);
// Collect INTERFACE_SOURCES of all direct link-dependencies.
- std::vector<EvaluatedTargetPropertyEntry> linkInterfaceSourcesEntries;
+ EvaluatedTargetPropertyEntries linkInterfaceSourcesEntries;
AddInterfaceEntries(this, config, "INTERFACE_SOURCES", std::string(),
&dagChecker, linkInterfaceSourcesEntries);
std::vector<std::string>::size_type numFilesBefore = files.size();
@@ -1554,7 +1521,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
bool contextDependentObjects = false;
std::vector<std::string>::size_type numFilesBefore2 = files.size();
if (this->GetType() != cmStateEnums::OBJECT_LIBRARY) {
- std::vector<EvaluatedTargetPropertyEntry> linkObjectsEntries;
+ EvaluatedTargetPropertyEntries linkObjectsEntries;
AddObjectEntries(this, config, &dagChecker, linkObjectsEntries);
contextDependentObjects = processSources(this, linkObjectsEntries, files,
uniqueSrcs, debugSources);
@@ -1716,14 +1683,6 @@ void cmGeneratorTarget::ComputeKindedSources(KindedSources& files,
}
} else if (ext == "resx") {
kind = SourceKindResx;
- // Build and save the name of the corresponding .h file
- // This relationship will be used later when building the project files.
- // Both names would have been auto generated from Visual Studio
- // where the user supplied the file name and Visual Studio
- // appended the suffix.
- std::string resx = sf->ResolveFullPath();
- std::string hFileName = resx.substr(0, resx.find_last_of('.')) + ".h";
- files.ExpectedResxHeaders.insert(hFileName);
} else if (ext == "appxmanifest") {
kind = SourceKindAppManifest;
} else if (ext == "manifest") {
@@ -1732,16 +1691,6 @@ void cmGeneratorTarget::ComputeKindedSources(KindedSources& files,
kind = SourceKindCertificate;
} else if (ext == "xaml") {
kind = SourceKindXaml;
- // Build and save the name of the corresponding .h and .cpp file
- // This relationship will be used later when building the project files.
- // Both names would have been auto generated from Visual Studio
- // where the user supplied the file name and Visual Studio
- // appended the suffix.
- std::string xaml = sf->ResolveFullPath();
- std::string hFileName = xaml + ".h";
- std::string cppFileName = xaml + ".cpp";
- files.ExpectedXamlHeaders.insert(hFileName);
- files.ExpectedXamlSources.insert(cppFileName);
} else if (header_regex.find(sf->ResolveFullPath())) {
kind = SourceKindHeader;
} else {
@@ -1799,6 +1748,18 @@ void cmGeneratorTarget::ComputeAllConfigSources() const
}
}
+std::vector<cmGeneratorTarget::AllConfigSource>
+cmGeneratorTarget::GetAllConfigSources(SourceKind kind) const
+{
+ std::vector<AllConfigSource> result;
+ for (AllConfigSource const& source : this->GetAllConfigSources()) {
+ if (source.Kind == kind) {
+ result.push_back(source);
+ }
+ }
+ return result;
+}
+
std::set<std::string> cmGeneratorTarget::GetAllConfigCompileLanguages() const
{
std::set<std::string> languages;
@@ -3169,6 +3130,20 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(std::string& flags) const
flags += "]";
}
+ } else if (compiler == "Clang") {
+ for (CudaArchitecture& architecture : architectures) {
+ flags += " --cuda-gpu-arch=sm_" + architecture.name;
+
+ if (!architecture.real) {
+ Makefile->IssueMessage(
+ MessageType::WARNING,
+ "Clang doesn't support disabling CUDA real code generation.");
+ }
+
+ if (!architecture.virtual_) {
+ flags += " --no-cuda-include-ptx=sm_" + architecture.name;
+ }
+ }
}
}
@@ -3216,13 +3191,13 @@ std::string cmGeneratorTarget::GetCreateRuleVariable(
}
namespace {
-void processIncludeDirectories(
- cmGeneratorTarget const* tgt,
- std::vector<EvaluatedTargetPropertyEntry>& entries,
- std::vector<BT<std::string>>& includes,
- std::unordered_set<std::string>& uniqueIncludes, bool debugIncludes)
+void processIncludeDirectories(cmGeneratorTarget const* tgt,
+ EvaluatedTargetPropertyEntries& entries,
+ std::vector<BT<std::string>>& includes,
+ std::unordered_set<std::string>& uniqueIncludes,
+ bool debugIncludes)
{
- for (EvaluatedTargetPropertyEntry& entry : entries) {
+ for (EvaluatedTargetPropertyEntry& entry : entries.Entries) {
cmLinkImplItem const& item = entry.LinkImplItem;
std::string const& targetName = item.AsStr();
bool const fromImported = item.Target && item.Target->IsImported();
@@ -3343,9 +3318,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
this->DebugIncludesDone = true;
}
- std::vector<EvaluatedTargetPropertyEntry> entries =
- EvaluateTargetPropertyEntries(this, config, lang, &dagChecker,
- this->IncludeDirectoriesEntries);
+ EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
+ this, config, lang, &dagChecker, this->IncludeDirectoriesEntries);
if (lang == "Swift") {
AddSwiftImplicitIncludeDirectories(this, config, entries);
@@ -3371,7 +3345,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
EvaluatedTargetPropertyEntry ee(lib, cmListFileBacktrace());
ee.Values.emplace_back(std::move(libDir));
- entries.emplace_back(std::move(ee));
+ entries.Entries.emplace_back(std::move(ee));
}
}
@@ -3392,14 +3366,14 @@ const auto DL_BEGIN = "<DEVICE_LINK>"_s;
const auto DL_END = "</DEVICE_LINK>"_s;
void processOptions(cmGeneratorTarget const* tgt,
- std::vector<EvaluatedTargetPropertyEntry> const& entries,
+ EvaluatedTargetPropertyEntries const& entries,
std::vector<BT<std::string>>& options,
std::unordered_set<std::string>& uniqueOptions,
bool debugOptions, const char* logName, OptionsParse parse,
bool processDeviceOptions = false)
{
bool splitOption = !processDeviceOptions;
- for (EvaluatedTargetPropertyEntry const& entry : entries) {
+ for (EvaluatedTargetPropertyEntry const& entry : entries.Entries) {
std::string usedOptions;
for (std::string const& opt : entry.Values) {
if (processDeviceOptions && (opt == DL_BEGIN || opt == DL_END)) {
@@ -3531,9 +3505,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileOptions(
this->DebugCompileOptionsDone = true;
}
- std::vector<EvaluatedTargetPropertyEntry> entries =
- EvaluateTargetPropertyEntries(this, config, language, &dagChecker,
- this->CompileOptionsEntries);
+ EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
+ this, config, language, &dagChecker, this->CompileOptionsEntries);
AddInterfaceEntries(this, config, "INTERFACE_COMPILE_OPTIONS", language,
&dagChecker, entries);
@@ -3577,9 +3550,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileFeatures(
this->DebugCompileFeaturesDone = true;
}
- std::vector<EvaluatedTargetPropertyEntry> entries =
- EvaluateTargetPropertyEntries(this, config, std::string(), &dagChecker,
- this->CompileFeaturesEntries);
+ EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
+ this, config, std::string(), &dagChecker, this->CompileFeaturesEntries);
AddInterfaceEntries(this, config, "INTERFACE_COMPILE_FEATURES",
std::string(), &dagChecker, entries);
@@ -3625,9 +3597,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions(
this->DebugCompileDefinitionsDone = true;
}
- std::vector<EvaluatedTargetPropertyEntry> entries =
- EvaluateTargetPropertyEntries(this, config, language, &dagChecker,
- this->CompileDefinitionsEntries);
+ EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
+ this, config, language, &dagChecker, this->CompileDefinitionsEntries);
AddInterfaceEntries(this, config, "INTERFACE_COMPILE_DEFINITIONS", language,
&dagChecker, entries);
@@ -3647,7 +3618,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions(
case cmPolicies::OLD: {
std::unique_ptr<TargetPropertyEntry> entry =
CreateTargetPropertyEntry(*configProp);
- entries.emplace_back(EvaluateTargetPropertyEntry(
+ entries.Entries.emplace_back(EvaluateTargetPropertyEntry(
this, config, language, &dagChecker, *entry));
} break;
case cmPolicies::NEW:
@@ -3687,9 +3658,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetPrecompileHeaders(
this->DebugPrecompileHeadersDone = true;
}
- std::vector<EvaluatedTargetPropertyEntry> entries =
- EvaluateTargetPropertyEntries(this, config, language, &dagChecker,
- this->PrecompileHeadersEntries);
+ EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
+ this, config, language, &dagChecker, this->PrecompileHeadersEntries);
AddInterfaceEntries(this, config, "INTERFACE_PRECOMPILE_HEADERS", language,
&dagChecker, entries);
@@ -3894,6 +3864,10 @@ std::string cmGeneratorTarget::GetPchFileObject(const std::string& config,
pchSource, false, cmSourceFileLocationKind::Known);
filename = cmStrCat(this->ObjectDirectory, this->GetObjectName(pchSf));
+ if (this->GetGlobalGenerator()->IsMultiConfig()) {
+ cmSystemTools::ReplaceString(
+ filename, this->GetGlobalGenerator()->GetCMakeCFGIntDir(), config);
+ }
}
return inserted.first->second;
}
@@ -4064,9 +4038,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions(
this->DebugLinkOptionsDone = true;
}
- std::vector<EvaluatedTargetPropertyEntry> entries =
- EvaluateTargetPropertyEntries(this, config, language, &dagChecker,
- this->LinkOptionsEntries);
+ EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
+ this, config, language, &dagChecker, this->LinkOptionsEntries);
AddInterfaceEntries(this, config, "INTERFACE_LINK_OPTIONS", language,
&dagChecker, entries,
@@ -4205,14 +4178,14 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetStaticLibraryLinkOptions(
cmGeneratorExpressionDAGChecker dagChecker(this, "STATIC_LIBRARY_OPTIONS",
nullptr, nullptr);
- std::vector<EvaluatedTargetPropertyEntry> entries;
+ EvaluatedTargetPropertyEntries entries;
if (cmProp linkOptions = this->GetProperty("STATIC_LIBRARY_OPTIONS")) {
std::vector<std::string> options = cmExpandedList(*linkOptions);
for (const auto& option : options) {
std::unique_ptr<TargetPropertyEntry> entry =
CreateTargetPropertyEntry(option);
- entries.emplace_back(EvaluateTargetPropertyEntry(this, config, language,
- &dagChecker, *entry));
+ entries.Entries.emplace_back(EvaluateTargetPropertyEntry(
+ this, config, language, &dagChecker, *entry));
}
}
processOptions(this, entries, result, uniqueOptions, false,
@@ -4223,12 +4196,12 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetStaticLibraryLinkOptions(
namespace {
void processLinkDirectories(cmGeneratorTarget const* tgt,
- std::vector<EvaluatedTargetPropertyEntry>& entries,
+ EvaluatedTargetPropertyEntries& entries,
std::vector<BT<std::string>>& directories,
std::unordered_set<std::string>& uniqueDirectories,
bool debugDirectories)
{
- for (EvaluatedTargetPropertyEntry& entry : entries) {
+ for (EvaluatedTargetPropertyEntry& entry : entries.Entries) {
cmLinkImplItem const& item = entry.LinkImplItem;
std::string const& targetName = item.AsStr();
@@ -4327,9 +4300,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDirectories(
this->DebugLinkDirectoriesDone = true;
}
- std::vector<EvaluatedTargetPropertyEntry> entries =
- EvaluateTargetPropertyEntries(this, config, language, &dagChecker,
- this->LinkDirectoriesEntries);
+ EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
+ this, config, language, &dagChecker, this->LinkDirectoriesEntries);
AddInterfaceEntries(this, config, "INTERFACE_LINK_DIRECTORIES", language,
&dagChecker, entries,
@@ -4360,14 +4332,14 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDepends(
cmGeneratorExpressionDAGChecker dagChecker(this, "LINK_DEPENDS", nullptr,
nullptr);
- std::vector<EvaluatedTargetPropertyEntry> entries;
+ EvaluatedTargetPropertyEntries entries;
if (cmProp linkDepends = this->GetProperty("LINK_DEPENDS")) {
std::vector<std::string> depends = cmExpandedList(*linkDepends);
for (const auto& depend : depends) {
std::unique_ptr<TargetPropertyEntry> entry =
CreateTargetPropertyEntry(depend);
- entries.emplace_back(EvaluateTargetPropertyEntry(this, config, language,
- &dagChecker, *entry));
+ entries.Entries.emplace_back(EvaluateTargetPropertyEntry(
+ this, config, language, &dagChecker, *entry));
}
}
AddInterfaceEntries(this, config, "INTERFACE_LINK_DEPENDS", language,
@@ -5738,6 +5710,25 @@ void cmGeneratorTarget::GetTargetVersion(const std::string& property,
}
}
+std::string cmGeneratorTarget::GetRuntimeLinkLibrary(
+ std::string const& lang, std::string const& config) const
+{
+ // This is activated by the presence of a default selection whether or
+ // not it is overridden by a property.
+ cmProp runtimeLibraryDefault = this->Makefile->GetDef(
+ cmStrCat("CMAKE_", lang, "_RUNTIME_LIBRARY_DEFAULT"));
+ if (!runtimeLibraryDefault || runtimeLibraryDefault->empty()) {
+ return std::string();
+ }
+ cmProp runtimeLibraryValue =
+ this->Target->GetProperty(cmStrCat(lang, "_RUNTIME_LIBRARY"));
+ if (!runtimeLibraryValue) {
+ runtimeLibraryValue = runtimeLibraryDefault;
+ }
+ return cmSystemTools::UpperCase(cmGeneratorExpression::Evaluate(
+ *runtimeLibraryValue, this->LocalGenerator, config, this));
+}
+
std::string cmGeneratorTarget::GetFortranModuleDirectory(
std::string const& working_dir) const
{
@@ -5885,6 +5876,7 @@ void cmGeneratorTarget::ExpandLinkItems(
std::string const& prop, std::string const& value, std::string const& config,
cmGeneratorTarget const* headTarget, bool usage_requirements_only,
std::vector<cmLinkItem>& items, bool& hadHeadSensitiveCondition,
+ bool& hadContextSensitiveCondition,
bool& hadLinkLanguageSensitiveCondition) const
{
// Keep this logic in sync with ComputeLinkImplementationLibraries.
@@ -5903,6 +5895,7 @@ void cmGeneratorTarget::ExpandLinkItems(
libs);
this->LookupLinkItems(libs, cge->GetBacktrace(), items);
hadHeadSensitiveCondition = cge->GetHadHeadSensitiveCondition();
+ hadContextSensitiveCondition = cge->GetHadContextSensitiveCondition();
hadLinkLanguageSensitiveCondition =
cge->GetHadLinkLanguageSensitiveCondition();
}
@@ -6407,6 +6400,7 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
this->ExpandLinkItems(linkIfaceProp, *explicitLibraries, config,
headTarget, usage_requirements_only, iface.Libraries,
iface.HadHeadSensitiveCondition,
+ iface.HadContextSensitiveCondition,
iface.HadLinkLanguageSensitiveCondition);
} else if (!cmp0022NEW)
// If CMP0022 is NEW then the plain tll signature sets the
@@ -6427,10 +6421,12 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
static const std::string newProp = "INTERFACE_LINK_LIBRARIES";
if (cmProp newExplicitLibraries = this->GetProperty(newProp)) {
bool hadHeadSensitiveConditionDummy = false;
+ bool hadContextSensitiveConditionDummy = false;
bool hadLinkLanguageSensitiveConditionDummy = false;
this->ExpandLinkItems(newProp, *newExplicitLibraries, config,
headTarget, usage_requirements_only, ifaceLibs,
hadHeadSensitiveConditionDummy,
+ hadContextSensitiveConditionDummy,
hadLinkLanguageSensitiveConditionDummy);
}
if (ifaceLibs != iface.Libraries) {
@@ -6498,6 +6494,7 @@ const cmLinkInterface* cmGeneratorTarget::GetImportLinkInterface(
this->ExpandLinkItems(info->LibrariesProp, info->Libraries, config,
headTarget, usage_requirements_only, iface.Libraries,
iface.HadHeadSensitiveCondition,
+ iface.HadContextSensitiveCondition,
iface.HadLinkLanguageSensitiveCondition);
std::vector<std::string> deps = cmExpandedList(info->SharedDeps);
this->LookupLinkItems(deps, cmListFileBacktrace(), iface.SharedDeps);
@@ -7020,6 +7017,9 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
if (cge->GetHadHeadSensitiveCondition()) {
impl.HadHeadSensitiveCondition = true;
}
+ if (cge->GetHadContextSensitiveCondition()) {
+ impl.HadContextSensitiveCondition = true;
+ }
if (cge->GetHadLinkLanguageSensitiveCondition()) {
impl.HadLinkLanguageSensitiveCondition = true;
}
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 2ef7b43..788fa23 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -117,9 +117,6 @@ public:
struct KindedSources
{
std::vector<SourceAndKind> Sources;
- std::set<std::string> ExpectedResxHeaders;
- std::set<std::string> ExpectedXamlHeaders;
- std::set<std::string> ExpectedXamlSources;
bool Initialized = false;
};
@@ -137,6 +134,9 @@ public:
per-source configurations assigned. */
std::vector<AllConfigSource> const& GetAllConfigSources() const;
+ /** Get all sources needed for all configurations with given kind. */
+ std::vector<AllConfigSource> GetAllConfigSources(SourceKind kind) const;
+
/** Get all languages used to compile sources in any configuration.
This excludes the languages of objects from object libraries. */
std::set<std::string> GetAllConfigCompileLanguages() const;
@@ -151,8 +151,6 @@ public:
void GetModuleDefinitionSources(std::vector<cmSourceFile const*>&,
const std::string& config) const;
- void GetResxSources(std::vector<cmSourceFile const*>&,
- const std::string& config) const;
void GetExternalObjects(std::vector<cmSourceFile const*>&,
const std::string& config) const;
void GetHeaderSources(std::vector<cmSourceFile const*>&,
@@ -161,20 +159,8 @@ public:
const std::string& config) const;
void GetCustomCommands(std::vector<cmSourceFile const*>&,
const std::string& config) const;
- void GetExpectedResxHeaders(std::set<std::string>&,
- const std::string& config) const;
- void GetAppManifest(std::vector<cmSourceFile const*>&,
- const std::string& config) const;
void GetManifests(std::vector<cmSourceFile const*>&,
const std::string& config) const;
- void GetCertificates(std::vector<cmSourceFile const*>&,
- const std::string& config) const;
- void GetXamlSources(std::vector<cmSourceFile const*>&,
- const std::string& config) const;
- void GetExpectedXamlHeaders(std::set<std::string>&,
- const std::string& config) const;
- void GetExpectedXamlSources(std::set<std::string>&,
- const std::string& config) const;
std::set<cmLinkItem> const& GetUtilityItems() const;
@@ -245,7 +231,7 @@ public:
/** Get the full path to the target according to the settings in its
makefile and the configuration type. */
std::string GetFullPath(
- const std::string& config = "",
+ const std::string& config,
cmStateEnums::ArtifactType artifact = cmStateEnums::RuntimeBinaryArtifact,
bool realname = false) const;
std::string NormalGetFullPath(const std::string& config,
@@ -283,7 +269,7 @@ public:
/** Get the full name of the target according to the settings in its
makefile. */
- std::string GetFullName(const std::string& config = "",
+ std::string GetFullName(const std::string& config,
cmStateEnums::ArtifactType artifact =
cmStateEnums::RuntimeBinaryArtifact) const;
@@ -326,8 +312,7 @@ public:
std::string GetSOName(const std::string& config) const;
void GetFullNameComponents(std::string& prefix, std::string& base,
- std::string& suffix,
- const std::string& config = "",
+ std::string& suffix, const std::string& config,
cmStateEnums::ArtifactType artifact =
cmStateEnums::RuntimeBinaryArtifact) const;
@@ -540,7 +525,7 @@ public:
configuration name is given then the generator will add its
subdirectory for that configuration. Otherwise just the canonical
output directory is given. */
- std::string GetDirectory(const std::string& config = "",
+ std::string GetDirectory(const std::string& config,
cmStateEnums::ArtifactType artifact =
cmStateEnums::RuntimeBinaryArtifact) const;
@@ -548,7 +533,7 @@ public:
If the configuration name is given then the generator will add its
subdirectory for that configuration. Otherwise just the canonical
compiler pdb output directory is given. */
- std::string GetCompilePDBDirectory(const std::string& config = "") const;
+ std::string GetCompilePDBDirectory(const std::string& config) const;
/** Get sources that must be built before the given source. */
std::vector<cmSourceFile*> const* GetSourceDepends(
@@ -577,7 +562,7 @@ public:
std::string GetPDBOutputName(const std::string& config) const;
/** Get the name of the pdb file for the target. */
- std::string GetPDBName(const std::string& config = "") const;
+ std::string GetPDBName(const std::string& config) const;
/** Whether this library has soname enabled and platform supports it. */
bool HasSOName(const std::string& config) const;
@@ -595,10 +580,10 @@ public:
bool IsNullImpliedByLinkLibraries(const std::string& p) const;
/** Get the name of the compiler pdb file for the target. */
- std::string GetCompilePDBName(const std::string& config = "") const;
+ std::string GetCompilePDBName(const std::string& config) const;
/** Get the path for the MSVC /Fd option for this target. */
- std::string GetCompilePDBPath(const std::string& config = "") const;
+ std::string GetCompilePDBPath(const std::string& config) const;
// Get the target base name.
std::string GetOutputName(const std::string& config,
@@ -798,6 +783,9 @@ public:
const std::string& fallback_property,
int& major, int& minor, int& patch) const;
+ std::string GetRuntimeLinkLibrary(std::string const& lang,
+ std::string const& config) const;
+
std::string GetFortranModuleDirectory(std::string const& working_dir) const;
const std::string& GetSourcesProperty() const;
@@ -989,6 +977,7 @@ private:
bool usage_requirements_only,
std::vector<cmLinkItem>& items,
bool& hadHeadSensitiveCondition,
+ bool& hadContextSensitiveCondition,
bool& hadLinkLanguageSensitiveCondition) const;
void LookupLinkItems(std::vector<std::string> const& names,
cmListFileBacktrace const& bt,
diff --git a/Source/cmGetPipes.cxx b/Source/cmGetPipes.cxx
index 4eda1c5..a5b6469 100644
--- a/Source/cmGetPipes.cxx
+++ b/Source/cmGetPipes.cxx
@@ -2,10 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGetPipes.h"
+#include <cm3p/uv.h>
#include <fcntl.h>
-#include "cm_uv.h"
-
#if defined(_WIN32) && !defined(__CYGWIN__)
# include <io.h>
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index c3ac672..851f426 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -11,6 +11,7 @@
#include "cmPolicies.h"
#include "cmProperty.h"
#include "cmPropertyDefinition.h"
+#include "cmSetPropertyCommand.h"
#include "cmSourceFile.h"
#include "cmState.h"
#include "cmStringAlgorithms.h"
@@ -48,7 +49,9 @@ bool HandleTargetMode(cmExecutionStatus& status, const std::string& name,
const std::string& propertyName);
bool HandleSourceMode(cmExecutionStatus& status, const std::string& name,
OutType infoType, const std::string& variable,
- const std::string& propertyName);
+ const std::string& propertyName,
+ cmMakefile& directory_makefile,
+ bool source_file_paths_should_be_absolute);
bool HandleTestMode(cmExecutionStatus& status, const std::string& name,
OutType infoType, const std::string& variable,
const std::string& propertyName);
@@ -78,6 +81,11 @@ bool cmGetPropertyCommand(std::vector<std::string> const& args,
std::string name;
std::string propertyName;
+ std::vector<std::string> source_file_directories;
+ std::vector<std::string> source_file_target_directories;
+ bool source_file_directory_option_enabled = false;
+ bool source_file_target_option_enabled = false;
+
// Get the scope from which to get the property.
cmProperty::ScopeType scope;
if (args[1] == "GLOBAL") {
@@ -111,7 +119,9 @@ bool cmGetPropertyCommand(std::vector<std::string> const& args,
DoingNone,
DoingName,
DoingProperty,
- DoingType
+ DoingType,
+ DoingSourceDirectory,
+ DoingSourceTargetDirectory
};
Doing doing = DoingName;
for (unsigned int i = 2; i < args.size(); ++i) {
@@ -132,6 +142,20 @@ bool cmGetPropertyCommand(std::vector<std::string> const& args,
} else if (doing == DoingName) {
doing = DoingNone;
name = args[i];
+ } else if (doing == DoingNone && scope == cmProperty::SOURCE_FILE &&
+ args[i] == "DIRECTORY") {
+ doing = DoingSourceDirectory;
+ source_file_directory_option_enabled = true;
+ } else if (doing == DoingNone && scope == cmProperty::SOURCE_FILE &&
+ args[i] == "TARGET_DIRECTORY") {
+ doing = DoingSourceTargetDirectory;
+ source_file_target_option_enabled = true;
+ } else if (doing == DoingSourceDirectory) {
+ source_file_directories.push_back(args[i]);
+ doing = DoingNone;
+ } else if (doing == DoingSourceTargetDirectory) {
+ source_file_target_directories.push_back(args[i]);
+ doing = DoingNone;
} else if (doing == DoingProperty) {
doing = DoingNone;
propertyName = args[i];
@@ -147,6 +171,16 @@ bool cmGetPropertyCommand(std::vector<std::string> const& args,
return false;
}
+ std::vector<cmMakefile*> source_file_directory_makefiles;
+ bool file_scopes_handled =
+ SetPropertyCommand::HandleAndValidateSourceFileDirectortoryScopes(
+ status, source_file_directory_option_enabled,
+ source_file_target_option_enabled, source_file_directories,
+ source_file_target_directories, source_file_directory_makefiles);
+ if (!file_scopes_handled) {
+ return false;
+ }
+
// Compute requested output.
if (infoType == OutBriefDoc) {
// Lookup brief documentation.
@@ -180,6 +214,11 @@ bool cmGetPropertyCommand(std::vector<std::string> const& args,
}
} else {
// Dispatch property getting.
+ cmMakefile& directory_scope_mf = *(source_file_directory_makefiles[0]);
+ bool source_file_paths_should_be_absolute =
+ source_file_directory_option_enabled ||
+ source_file_target_option_enabled;
+
switch (scope) {
case cmProperty::GLOBAL:
return HandleGlobalMode(status, name, infoType, variable,
@@ -191,8 +230,9 @@ bool cmGetPropertyCommand(std::vector<std::string> const& args,
return HandleTargetMode(status, name, infoType, variable,
propertyName);
case cmProperty::SOURCE_FILE:
- return HandleSourceMode(status, name, infoType, variable,
- propertyName);
+ return HandleSourceMode(status, name, infoType, variable, propertyName,
+ directory_scope_mf,
+ source_file_paths_should_be_absolute);
case cmProperty::TEST:
return HandleTestMode(status, name, infoType, variable, propertyName);
case cmProperty::VARIABLE:
@@ -331,7 +371,9 @@ bool HandleTargetMode(cmExecutionStatus& status, const std::string& name,
bool HandleSourceMode(cmExecutionStatus& status, const std::string& name,
OutType infoType, const std::string& variable,
- const std::string& propertyName)
+ const std::string& propertyName,
+ cmMakefile& directory_makefile,
+ const bool source_file_paths_should_be_absolute)
{
if (name.empty()) {
status.SetError("not given name for SOURCE scope.");
@@ -339,12 +381,17 @@ bool HandleSourceMode(cmExecutionStatus& status, const std::string& name,
}
// Get the source file.
- if (cmSourceFile* sf = status.GetMakefile().GetOrCreateSource(name)) {
+ const std::string source_file_absolute_path =
+ SetPropertyCommand::MakeSourceFilePathAbsoluteIfNeeded(
+ status, name, source_file_paths_should_be_absolute);
+ if (cmSourceFile* sf =
+ directory_makefile.GetOrCreateSource(source_file_absolute_path)) {
return StoreResult(infoType, status.GetMakefile(), variable,
sf->GetPropertyForUser(propertyName));
}
status.SetError(
- cmStrCat("given SOURCE name that could not be found or created: ", name));
+ cmStrCat("given SOURCE name that could not be found or created: ",
+ source_file_absolute_path));
return false;
}
diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx
index eefdc6c..5395bc8 100644
--- a/Source/cmGetSourceFilePropertyCommand.cxx
+++ b/Source/cmGetSourceFilePropertyCommand.cxx
@@ -4,35 +4,71 @@
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
+#include "cmSetPropertyCommand.h"
#include "cmSourceFile.h"
bool cmGetSourceFilePropertyCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
- if (args.size() != 3) {
+ std::vector<std::string>::size_type args_size = args.size();
+ if (args_size != 3 && args_size != 5) {
status.SetError("called with incorrect number of arguments");
return false;
}
+
+ std::vector<std::string> source_file_directories;
+ std::vector<std::string> source_file_target_directories;
+ bool source_file_directory_option_enabled = false;
+ bool source_file_target_option_enabled = false;
+
+ int property_arg_index = 2;
+ if (args[2] == "DIRECTORY" && args_size == 5) {
+ property_arg_index = 4;
+ source_file_directory_option_enabled = true;
+ source_file_directories.push_back(args[3]);
+ } else if (args[2] == "TARGET_DIRECTORY" && args_size == 5) {
+ property_arg_index = 4;
+ source_file_target_option_enabled = true;
+ source_file_target_directories.push_back(args[3]);
+ }
+
+ std::vector<cmMakefile*> source_file_directory_makefiles;
+ bool file_scopes_handled =
+ SetPropertyCommand::HandleAndValidateSourceFileDirectortoryScopes(
+ status, source_file_directory_option_enabled,
+ source_file_target_option_enabled, source_file_directories,
+ source_file_target_directories, source_file_directory_makefiles);
+ if (!file_scopes_handled) {
+ return false;
+ }
+
std::string const& var = args[0];
- std::string const& file = args[1];
- cmMakefile& mf = status.GetMakefile();
+ bool source_file_paths_should_be_absolute =
+ source_file_directory_option_enabled || source_file_target_option_enabled;
+ std::string const file =
+ SetPropertyCommand::MakeSourceFilePathAbsoluteIfNeeded(
+ status, args[1], source_file_paths_should_be_absolute);
+ cmMakefile& mf = *source_file_directory_makefiles[0];
cmSourceFile* sf = mf.GetSource(file);
// for the location we must create a source file first
- if (!sf && args[2] == "LOCATION") {
+ if (!sf && args[property_arg_index] == "LOCATION") {
sf = mf.CreateSource(file);
}
+
if (sf) {
const char* prop = nullptr;
- if (!args[2].empty()) {
- prop = sf->GetPropertyForUser(args[2]);
+ if (!args[property_arg_index].empty()) {
+ prop = sf->GetPropertyForUser(args[property_arg_index]);
}
if (prop) {
- mf.AddDefinition(var, prop);
+ // Set the value on the original Makefile scope, not the scope of the
+ // requested directory.
+ status.GetMakefile().AddDefinition(var, prop);
return true;
}
}
- mf.AddDefinition(var, "NOTFOUND");
+ status.GetMakefile().AddDefinition(var, "NOTFOUND");
return true;
}
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index de6a649..0b7ba04 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -52,8 +52,8 @@
#include "cmake.h"
#if !defined(CMAKE_BOOTSTRAP)
-# include "cm_jsoncpp_value.h"
-# include "cm_jsoncpp_writer.h"
+# include <cm3p/json/value.h>
+# include <cm3p/json/writer.h>
# include "cmCryptoHash.h"
# include "cmQtAutoGenGlobalInitializer.h"
@@ -320,7 +320,7 @@ bool cmGlobalGenerator::CheckTargetsForMissingSources() const
} else {
for (std::string const& config : configs) {
target->GetSourceFiles(srcs, config);
- if (srcs.empty()) {
+ if (!srcs.empty()) {
break;
}
}
@@ -2535,7 +2535,7 @@ void cmGlobalGenerator::AddGlobalTarget_EditCache(
}
GlobalTargetInfo gti;
gti.Name = editCacheTargetName;
- gti.PerConfig = false;
+ gti.PerConfig = cmTarget::PerConfig::No;
cmCustomCommandLine singleLine;
// Use generator preference for the edit_cache rule if it is defined.
@@ -2571,7 +2571,7 @@ void cmGlobalGenerator::AddGlobalTarget_RebuildCache(
gti.Name = rebuildCacheTargetName;
gti.Message = "Running CMake to regenerate build system...";
gti.UsesTerminal = true;
- gti.PerConfig = false;
+ gti.PerConfig = cmTarget::PerConfig::No;
cmCustomCommandLine singleLine;
singleLine.push_back(cmSystemTools::GetCMakeCommand());
singleLine.push_back("--regenerate-during-build");
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index a76ab3c..57c7808 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -28,7 +28,7 @@
#include "cmTargetDepend.h"
#if !defined(CMAKE_BOOTSTRAP)
-# include "cm_jsoncpp_value.h"
+# include <cm3p/json/value.h>
# include "cmFileLockPool.h"
#endif
@@ -553,7 +553,7 @@ protected:
std::vector<std::string> Depends;
std::string WorkingDir;
bool UsesTerminal = false;
- bool PerConfig = true;
+ cmTarget::PerConfig PerConfig = cmTarget::PerConfig::Yes;
bool StdPipesUTF8 = false;
};
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 8ef19cc..843b0f4 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -12,11 +12,11 @@
#include <cmext/algorithm>
#include <cmext/memory>
-#include "cmsys/FStream.hxx"
+#include <cm3p/json/reader.h>
+#include <cm3p/json/value.h>
+#include <cm3p/json/writer.h>
-#include "cm_jsoncpp_reader.h"
-#include "cm_jsoncpp_value.h"
-#include "cm_jsoncpp_writer.h"
+#include "cmsys/FStream.hxx"
#include "cmDocumentationEntry.h"
#include "cmFortranParser.h"
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index b89fb8f..44e632f 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -415,6 +415,11 @@ public:
std::set<std::string> GetCrossConfigs(const std::string& config) const;
+ const std::set<std::string>& GetDefaultConfigs() const
+ {
+ return this->DefaultConfigs;
+ }
+
protected:
void Generate() override;
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 5166de6..5dac072 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -6,12 +6,12 @@
#include <cm/memory>
+#include <cm3p/json/reader.h>
+
#include "cmsys/FStream.hxx"
#include "cmsys/Glob.hxx"
#include "cmsys/RegularExpression.hxx"
-#include "cm_jsoncpp_reader.h"
-
#include "cmAlgorithms.h"
#include "cmDocumentationEntry.h"
#include "cmGeneratorTarget.h"
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 28bd1ca..0932d06 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -112,6 +112,7 @@ void cmGlobalVisualStudioGenerator::WriteSLNHeader(std::ostream& fout)
{
char utf8bom[] = { char(0xEF), char(0xBB), char(0xBF) };
fout.write(utf8bom, 3);
+ fout << '\n';
switch (this->Version) {
case cmGlobalVisualStudioGenerator::VS9:
diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx
index 07e0793..d6a7afa 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.cxx
+++ b/Source/cmGlobalWatcomWMakeGenerator.cxx
@@ -44,6 +44,16 @@ void cmGlobalWatcomWMakeGenerator::EnableLanguage(
this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
}
+bool cmGlobalWatcomWMakeGenerator::SetSystemName(std::string const& s,
+ cmMakefile* mf)
+{
+ if (mf->GetSafeDefinition("CMAKE_SYSTEM_PROCESSOR") == "I86") {
+ mf->AddDefinition("CMAKE_GENERATOR_CC", "wcl");
+ mf->AddDefinition("CMAKE_GENERATOR_CXX", "wcl");
+ }
+ return this->cmGlobalUnixMakefileGenerator3::SetSystemName(s, mf);
+}
+
void cmGlobalWatcomWMakeGenerator::GetDocumentation(
cmDocumentationEntry& entry)
{
diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h
index c0daf8a..c47127f 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.h
+++ b/Source/cmGlobalWatcomWMakeGenerator.h
@@ -41,6 +41,9 @@ public:
/** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry);
+ /** Tell the generator about the target system. */
+ bool SetSystemName(std::string const& s, cmMakefile* mf) override;
+
/**
* Try to determine system information such as shared library
* extension, pthreads, byte order etc.
diff --git a/Source/cmJsonObjects.h b/Source/cmJsonObjects.h
index 64291cc..2fd4b26 100644
--- a/Source/cmJsonObjects.h
+++ b/Source/cmJsonObjects.h
@@ -8,7 +8,7 @@
#include <string>
#include <vector>
-#include "cm_jsoncpp_value.h"
+#include <cm3p/json/value.h>
class cmake;
class cmGlobalGenerator;
diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h
index f27648c..3d92935 100644
--- a/Source/cmLinkItem.h
+++ b/Source/cmLinkItem.h
@@ -54,6 +54,9 @@ struct cmLinkImplementationLibraries
// Libraries linked directly in other configurations.
// Needed only for OLD behavior of CMP0003.
std::vector<cmLinkItem> WrongConfigLibraries;
+
+ // Whether the list depends on a genex referencing the configuration.
+ bool HadContextSensitiveCondition = false;
};
struct cmLinkInterfaceLibraries
@@ -63,6 +66,9 @@ struct cmLinkInterfaceLibraries
// Whether the list depends on a genex referencing the head target.
bool HadHeadSensitiveCondition = false;
+
+ // Whether the list depends on a genex referencing the configuration.
+ bool HadContextSensitiveCondition = false;
};
struct cmLinkInterface : public cmLinkInterfaceLibraries
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index b862449..ad1cbd8 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2633,7 +2633,9 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
// Exclude the pch files from linking
if (this->Makefile->IsOn("CMAKE_LINK_PCH")) {
if (!ReuseFrom) {
- pch_sf->SetProperty("OBJECT_OUTPUTS", pchFile.c_str());
+ pch_sf->AppendProperty(
+ "OBJECT_OUTPUTS",
+ cmStrCat("$<$<CONFIG:", config, ">:", pchFile, ">"));
} else {
auto reuseTarget =
this->GlobalGenerator->FindGeneratorTarget(*ReuseFrom);
@@ -2732,9 +2734,11 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
std::string pchSourceObj =
reuseTarget->GetPchFileObject(config, lang, arch);
+ const std::string configUpper = cmSystemTools::UpperCase(config);
+
// Link to the pch object file
target->Target->AppendProperty(
- "LINK_FLAGS",
+ cmStrCat("LINK_FLAGS_", configUpper),
cmStrCat(" ",
this->ConvertToOutputFormat(pchSourceObj, SHELL)),
true);
@@ -2756,6 +2760,120 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
}
}
+namespace {
+
+inline void RegisterUnitySources(cmGeneratorTarget* target, cmSourceFile* sf,
+ std::string const& filename)
+{
+ target->AddSourceFileToUnityBatch(sf->ResolveFullPath());
+ sf->SetProperty("UNITY_SOURCE_FILE", filename.c_str());
+}
+
+inline void IncludeFileInUnitySources(cmGeneratedFileStream& unity_file,
+ std::string const& sf_full_path,
+ cmProp beforeInclude,
+ cmProp afterInclude)
+{
+ if (beforeInclude) {
+ unity_file << *beforeInclude << "\n";
+ }
+
+ unity_file << "#include \"" << sf_full_path << "\"\n";
+
+ if (afterInclude) {
+ unity_file << *afterInclude << "\n";
+ }
+}
+
+std::vector<std::string> AddUnityFilesModeAuto(
+ cmGeneratorTarget* target, std::string const& lang,
+ std::vector<cmSourceFile*> const& filtered_sources, cmProp beforeInclude,
+ cmProp afterInclude, std::string const& filename_base, size_t batchSize)
+{
+ if (batchSize == 0) {
+ batchSize = filtered_sources.size();
+ }
+
+ std::vector<std::string> unity_files;
+ for (size_t itemsLeft = filtered_sources.size(), chunk, batch = 0;
+ itemsLeft > 0; itemsLeft -= chunk, ++batch) {
+
+ chunk = std::min(itemsLeft, batchSize);
+
+ std::string filename = cmStrCat(filename_base, "unity_", batch,
+ (lang == "C") ? "_c.c" : "_cxx.cxx");
+
+ const std::string filename_tmp = cmStrCat(filename, ".tmp");
+ {
+ size_t begin = batch * batchSize;
+ size_t end = begin + chunk;
+
+ cmGeneratedFileStream file(
+ filename_tmp, false,
+ target->GetGlobalGenerator()->GetMakefileEncoding());
+ file << "/* generated by CMake */\n\n";
+
+ for (; begin != end; ++begin) {
+ cmSourceFile* sf = filtered_sources[begin];
+ RegisterUnitySources(target, sf, filename);
+ IncludeFileInUnitySources(file, sf->ResolveFullPath(), beforeInclude,
+ afterInclude);
+ }
+ }
+ cmSystemTools::MoveFileIfDifferent(filename_tmp, filename);
+ unity_files.emplace_back(std::move(filename));
+ }
+ return unity_files;
+}
+
+std::vector<std::string> AddUnityFilesModeGroup(
+ cmGeneratorTarget* target, std::string const& lang,
+ std::vector<cmSourceFile*> const& filtered_sources, cmProp beforeInclude,
+ cmProp afterInclude, std::string const& filename_base)
+{
+ std::vector<std::string> unity_files;
+
+ // sources organized by group name. Drop any source
+ // without a group
+ std::unordered_map<std::string, std::vector<cmSourceFile*>> explicit_mapping;
+ for (cmSourceFile* sf : filtered_sources) {
+ if (cmProp value = sf->GetProperty("UNITY_GROUP")) {
+ auto i = explicit_mapping.find(*value);
+ if (i == explicit_mapping.end()) {
+ std::vector<cmSourceFile*> sources{ sf };
+ explicit_mapping.emplace(*value, sources);
+ } else {
+ i->second.emplace_back(sf);
+ }
+ }
+ }
+
+ for (auto const& item : explicit_mapping) {
+ auto const& name = item.first;
+ std::string filename = cmStrCat(filename_base, "unity_", name,
+ (lang == "C") ? "_c.c" : "_cxx.cxx");
+
+ const std::string filename_tmp = cmStrCat(filename, ".tmp");
+ {
+ cmGeneratedFileStream file(
+ filename_tmp, false,
+ target->GetGlobalGenerator()->GetMakefileEncoding());
+ file << "/* generated by CMake */\n\n";
+
+ for (cmSourceFile* sf : item.second) {
+ RegisterUnitySources(target, sf, filename);
+ IncludeFileInUnitySources(file, sf->ResolveFullPath(), beforeInclude,
+ afterInclude);
+ }
+ }
+ cmSystemTools::MoveFileIfDifferent(filename_tmp, filename);
+ unity_files.emplace_back(std::move(filename));
+ }
+
+ return unity_files;
+}
+}
+
void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
{
if (!target->GetPropertyAsBool("UNITY_BUILD")) {
@@ -2784,6 +2902,7 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
cmProp beforeInclude =
target->GetProperty("UNITY_BUILD_CODE_BEFORE_INCLUDE");
cmProp afterInclude = target->GetProperty("UNITY_BUILD_CODE_AFTER_INCLUDE");
+ cmProp unityMode = target->GetProperty("UNITY_BUILD_MODE");
for (std::string lang : { "C", "CXX" }) {
std::vector<cmSourceFile*> filtered_sources;
@@ -2798,53 +2917,28 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
!sf->GetProperty("INCLUDE_DIRECTORIES");
});
- size_t batchSize = unityBatchSize;
- if (unityBatchSize == 0) {
- batchSize = filtered_sources.size();
+ std::vector<std::string> unity_files;
+ if (!unityMode || *unityMode == "BATCH") {
+ unity_files =
+ AddUnityFilesModeAuto(target, lang, filtered_sources, beforeInclude,
+ afterInclude, filename_base, unityBatchSize);
+ } else if (unityMode && *unityMode == "GROUP") {
+ unity_files =
+ AddUnityFilesModeGroup(target, lang, filtered_sources, beforeInclude,
+ afterInclude, filename_base);
+ } else {
+ // unity mode is set to an unsupported value
+ std::string e("Invalid UNITY_BUILD_MODE value of " + *unityMode +
+ " assigned to target " + target->GetName() +
+ ". Acceptable values are BATCH and GROUP.");
+ this->IssueMessage(MessageType::FATAL_ERROR, e);
}
- for (size_t itemsLeft = filtered_sources.size(), chunk, batch = 0;
- itemsLeft > 0; itemsLeft -= chunk, ++batch) {
-
- chunk = std::min(itemsLeft, batchSize);
-
- std::string filename = cmStrCat(filename_base, "unity_", batch,
- (lang == "C") ? "_c.c" : "_cxx.cxx");
-
- const std::string filename_tmp = cmStrCat(filename, ".tmp");
- {
- size_t begin = batch * batchSize;
- size_t end = begin + chunk;
-
- cmGeneratedFileStream file(
- filename_tmp, false,
- this->GetGlobalGenerator()->GetMakefileEncoding());
- file << "/* generated by CMake */\n\n";
-
- for (; begin != end; ++begin) {
- cmSourceFile* sf = filtered_sources[begin];
-
- target->AddSourceFileToUnityBatch(sf->ResolveFullPath());
- sf->SetProperty("UNITY_SOURCE_FILE", filename.c_str());
-
- if (beforeInclude) {
- file << *beforeInclude << "\n";
- }
-
- file << "#include \"" << sf->ResolveFullPath() << "\"\n";
-
- if (afterInclude) {
- file << *afterInclude << "\n";
- }
- }
- }
- cmSystemTools::MoveFileIfDifferent(filename_tmp, filename);
-
- target->AddSource(filename, true);
-
- auto unity = this->Makefile->GetOrCreateSource(filename);
+ for (auto const& file : unity_files) {
+ auto unity = this->GetMakefile()->GetOrCreateSource(file);
+ target->AddSource(file, true);
unity->SetProperty("SKIP_UNITY_BUILD_INCLUSION", "ON");
- unity->SetProperty("UNITY_SOURCE_FILE", filename.c_str());
+ unity->SetProperty("UNITY_SOURCE_FILE", file.c_str());
}
}
}
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 1492304..9beae61 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -13,7 +13,7 @@
#include <unordered_map>
#include <vector>
-#include "cm_kwiml.h"
+#include <cm3p/kwiml/int.h>
#include "cmCustomCommandTypes.h"
#include "cmListFileCache.h"
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index d1944a4..e52e0d3 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -97,6 +97,43 @@ void cmLocalNinjaGenerator::Generate()
if (target->Target->IsPerConfig()) {
for (auto const& config : this->GetConfigNames()) {
tg->Generate(config);
+ if (target->GetType() == cmStateEnums::GLOBAL_TARGET &&
+ this->GetGlobalGenerator()->IsMultiConfig()) {
+ cmNinjaBuild phonyAlias("phony");
+ this->GetGlobalNinjaGenerator()->AppendTargetOutputs(
+ target.get(), phonyAlias.Outputs, "");
+ this->GetGlobalNinjaGenerator()->AppendTargetOutputs(
+ target.get(), phonyAlias.ExplicitDeps, config);
+ this->GetGlobalNinjaGenerator()->WriteBuild(
+ *this->GetGlobalNinjaGenerator()->GetConfigFileStream(config),
+ phonyAlias);
+ }
+ }
+ if (target->GetType() == cmStateEnums::GLOBAL_TARGET &&
+ this->GetGlobalGenerator()->IsMultiConfig()) {
+ if (!this->GetGlobalNinjaGenerator()->GetDefaultConfigs().empty()) {
+ cmNinjaBuild phonyAlias("phony");
+ this->GetGlobalNinjaGenerator()->AppendTargetOutputs(
+ target.get(), phonyAlias.Outputs, "");
+ for (auto const& config :
+ this->GetGlobalNinjaGenerator()->GetDefaultConfigs()) {
+ this->GetGlobalNinjaGenerator()->AppendTargetOutputs(
+ target.get(), phonyAlias.ExplicitDeps, config);
+ }
+ this->GetGlobalNinjaGenerator()->WriteBuild(
+ *this->GetGlobalNinjaGenerator()->GetDefaultFileStream(),
+ phonyAlias);
+ }
+ cmNinjaBuild phonyAlias("phony");
+ this->GetGlobalNinjaGenerator()->AppendTargetOutputs(
+ target.get(), phonyAlias.Outputs, "all");
+ for (auto const& config : this->GetConfigNames()) {
+ this->GetGlobalNinjaGenerator()->AppendTargetOutputs(
+ target.get(), phonyAlias.ExplicitDeps, config);
+ }
+ this->GetGlobalNinjaGenerator()->WriteBuild(
+ *this->GetGlobalNinjaGenerator()->GetDefaultFileStream(),
+ phonyAlias);
}
} else {
tg->Generate("");
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index 02e2c6d..9076e26 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -4,7 +4,7 @@
#include <cmext/algorithm>
-#include "cm_expat.h"
+#include <cm3p/expat.h>
#include "cmAlgorithms.h"
#include "cmGeneratorTarget.h"
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index e18fac3..5d50e2d 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -7,10 +7,9 @@
#include <windows.h>
+#include <cm3p/expat.h>
#include <ctype.h> // for isspace
-#include "cm_expat.h"
-
#include "cmComputeLinkInformation.h"
#include "cmCustomCommand.h"
#include "cmCustomCommandGenerator.h"
@@ -284,6 +283,7 @@ void cmLocalVisualStudio7Generator::WriteConfigurations(
}
cmVS7FlagTable cmLocalVisualStudio7GeneratorFortranFlagTable[] = {
{ "Preprocess", "fpp", "Run Preprocessor on files", "preprocessYes", 0 },
+ { "Preprocess", "nofpp", "Run Preprocessor on files", "preprocessNo", 0 },
{ "SuppressStartupBanner", "nologo", "SuppressStartupBanner", "true", 0 },
{ "SourceFileFormat", "fixed", "Use Fixed Format", "fileFormatFixed", 0 },
{ "SourceFileFormat", "free", "Use Free Format", "fileFormatFree", 0 },
@@ -682,6 +682,18 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
default:
break;
}
+
+ switch (cmOutputConverter::GetFortranPreprocess(
+ target->GetSafeProperty("Fortran_PREPROCESS"))) {
+ case cmOutputConverter::FortranPreprocess::Needed:
+ flags += " -fpp";
+ break;
+ case cmOutputConverter::FortranPreprocess::NotNeeded:
+ flags += " -nofpp";
+ break;
+ default:
+ break;
+ }
}
// Get preprocessor definitions for this directory.
@@ -1474,6 +1486,20 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
}
if (lg->FortranProject) {
+ switch (cmOutputConverter::GetFortranPreprocess(
+ sf.GetSafeProperty("Fortran_PREPROCESS"))) {
+ case cmOutputConverter::FortranPreprocess::Needed:
+ fc.CompileFlags = cmStrCat("-fpp ", fc.CompileFlags);
+ needfc = true;
+ break;
+ case cmOutputConverter::FortranPreprocess::NotNeeded:
+ fc.CompileFlags = cmStrCat("-nofpp ", fc.CompileFlags);
+ needfc = true;
+ break;
+ default:
+ break;
+ }
+
switch (cmOutputConverter::GetFortranFormat(
sf.GetSafeProperty("Fortran_FORMAT"))) {
case cmOutputConverter::FortranFormatFixed:
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 6c46353..154da50 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -20,11 +20,12 @@
#include <cmext/algorithm>
#include <cmext/string_view>
+#include <cm3p/json/value.h>
+#include <cm3p/json/writer.h>
+
#include "cmsys/FStream.hxx"
#include "cmsys/RegularExpression.hxx"
-#include "cm_jsoncpp_value.h"
-#include "cm_jsoncpp_writer.h"
#include "cm_sys_stat.h"
#include "cmCommandArgumentParserHelper.h"
@@ -2080,11 +2081,11 @@ cmTarget* cmMakefile::AddExecutable(const std::string& exeName,
cmTarget* cmMakefile::AddNewTarget(cmStateEnums::TargetType type,
const std::string& name)
{
- auto it =
- this->Targets
- .emplace(name,
- cmTarget(name, type, cmTarget::VisibilityNormal, this, true))
- .first;
+ auto it = this->Targets
+ .emplace(name,
+ cmTarget(name, type, cmTarget::VisibilityNormal, this,
+ cmTarget::PerConfig::Yes))
+ .first;
this->OrderedTargets.push_back(&it->second);
this->GetGlobalGenerator()->IndexTarget(&it->second);
this->GetStateSnapshot().GetDirectory().AddNormalTargetName(name);
@@ -2403,11 +2404,11 @@ cmSourceGroup* cmMakefile::GetOrCreateSourceGroup(
cmSourceGroup* cmMakefile::GetOrCreateSourceGroup(const std::string& name)
{
- const char* delimiter = this->GetDefinition("SOURCE_GROUP_DELIMITER");
- if (delimiter == nullptr) {
- delimiter = "\\";
+ const char* delimiters = this->GetDefinition("SOURCE_GROUP_DELIMITER");
+ if (delimiters == nullptr) {
+ delimiters = "/\\";
}
- return this->GetOrCreateSourceGroup(cmTokenize(name, delimiter));
+ return this->GetOrCreateSourceGroup(cmTokenize(name, delimiters));
}
/**
@@ -4260,7 +4261,7 @@ cmTarget* cmMakefile::AddImportedTarget(const std::string& name,
new cmTarget(name, type,
global ? cmTarget::VisibilityImportedGlobally
: cmTarget::VisibilityImported,
- this, true));
+ this, cmTarget::PerConfig::Yes));
// Add to the set of available imported targets.
this->ImportedTargets[name] = target.get();
diff --git a/Source/cmMakefileProfilingData.cxx b/Source/cmMakefileProfilingData.cxx
index adf4eee..e0150dc 100644
--- a/Source/cmMakefileProfilingData.cxx
+++ b/Source/cmMakefileProfilingData.cxx
@@ -6,12 +6,12 @@
#include <stdexcept>
#include <vector>
+#include <cm3p/json/value.h>
+#include <cm3p/json/writer.h>
+
#include "cmsys/FStream.hxx"
#include "cmsys/SystemInformation.hxx"
-#include "cm_jsoncpp_value.h"
-#include "cm_jsoncpp_writer.h"
-
#include "cmListFileCache.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 5f0cfcf..c98e3a9 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -541,6 +541,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
// Add Fortran format flags.
if (lang == "Fortran") {
this->AppendFortranFormatFlags(flags, source);
+ this->AppendFortranPreprocessFlags(flags, source);
}
// Add flags from source file properties.
@@ -895,9 +896,14 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
// Check for extra outputs created by the compilation.
std::vector<std::string> outputs(1, relativeObj);
if (cmProp extra_outputs_str = source.GetProperty("OBJECT_OUTPUTS")) {
- // Register these as extra files to clean.
- cmExpandList(*extra_outputs_str, outputs);
- this->CleanFiles.insert(outputs.begin() + 1, outputs.end());
+ std::string evaluated_outputs = cmGeneratorExpression::Evaluate(
+ *extra_outputs_str, this->LocalGenerator, config);
+
+ if (!evaluated_outputs.empty()) {
+ // Register these as extra files to clean.
+ cmExpandList(evaluated_outputs, outputs);
+ this->CleanFiles.insert(outputs.begin() + 1, outputs.end());
+ }
}
// Write the rule.
diff --git a/Source/cmMathCommand.cxx b/Source/cmMathCommand.cxx
index f11b906..56221bf 100644
--- a/Source/cmMathCommand.cxx
+++ b/Source/cmMathCommand.cxx
@@ -4,7 +4,7 @@
#include <cstdio>
-#include "cm_kwiml.h"
+#include <cm3p/kwiml/int.h>
#include "cmExecutionStatus.h"
#include "cmExprParserHelper.h"
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index db069ed..f87eba7 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -1024,7 +1024,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
std::string prefix;
std::string base;
std::string suffix;
- gt->GetFullNameComponents(prefix, base, suffix);
+ gt->GetFullNameComponents(prefix, base, suffix, config);
std::string dbg_suffix = ".dbg";
// TODO: Where to document?
if (mf->GetDefinition("CMAKE_DEBUG_SYMBOL_SUFFIX")) {
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 0606484..c77a85b 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -14,8 +14,8 @@
#include <cm/memory>
#include <cmext/algorithm>
-#include "cm_jsoncpp_value.h"
-#include "cm_jsoncpp_writer.h"
+#include <cm3p/json/value.h>
+#include <cm3p/json/writer.h>
#include "cmComputeLinkInformation.h"
#include "cmCustomCommandGenerator.h"
@@ -106,7 +106,16 @@ std::string cmNinjaTargetGenerator::LanguagePreprocessRule(
std::string const& lang, const std::string& config) const
{
return cmStrCat(
- lang, "_PREPROCESS__",
+ lang, "_PREPROCESS_SCAN__",
+ cmGlobalNinjaGenerator::EncodeRuleName(this->GeneratorTarget->GetName()),
+ '_', config);
+}
+
+std::string cmNinjaTargetGenerator::LanguageDependencyRule(
+ std::string const& lang, const std::string& config) const
+{
+ return cmStrCat(
+ lang, "_SCAN__",
cmGlobalNinjaGenerator::EncodeRuleName(this->GeneratorTarget->GetName()),
'_', config);
}
@@ -183,6 +192,7 @@ std::string cmNinjaTargetGenerator::ComputeFlagsForObject(
// Add Fortran format flags.
if (language == "Fortran") {
this->AppendFortranFormatFlags(flags, *source);
+ this->AppendFortranPreprocessFlags(flags, *source);
}
// Add source file specific flags.
@@ -508,6 +518,91 @@ void cmNinjaTargetGenerator::WriteLanguageRules(const std::string& language,
this->WriteCompileRule(language, config);
}
+namespace {
+// Create the command to run the dependency scanner
+std::string GetScanCommand(const std::string& cmakeCmd, const std::string& tdi,
+ const std::string& lang, const std::string& ppFile,
+ bool needDyndep, const std::string& ddiFile)
+{
+ std::string ccmd =
+ cmStrCat(cmakeCmd, " -E cmake_ninja_depends --tdi=", tdi, " --lang=", lang,
+ " --pp=", ppFile, " --dep=$DEP_FILE");
+ if (needDyndep) {
+ ccmd = cmStrCat(ccmd, " --obj=$OBJ_FILE --ddi=", ddiFile);
+ }
+ return ccmd;
+}
+
+// Helper function to create dependency scanning rule, with optional
+// explicit preprocessing step if preprocessCommand is non-empty
+cmNinjaRule GetPreprocessScanRule(
+ const std::string& ruleName, cmRulePlaceholderExpander::RuleVariables& vars,
+ const std::string& responseFlag, const std::string& flags,
+ const std::string& launcher,
+ cmRulePlaceholderExpander* const rulePlaceholderExpander,
+ std::string scanCommand, cmLocalNinjaGenerator* generator,
+ const std::string& preprocessCommand = "")
+{
+ cmNinjaRule rule(ruleName);
+ // Explicit preprocessing always uses a depfile.
+ rule.DepType = ""; // no deps= for multiple outputs
+ rule.DepFile = "$DEP_FILE";
+
+ cmRulePlaceholderExpander::RuleVariables ppVars;
+ ppVars.CMTargetName = vars.CMTargetName;
+ ppVars.CMTargetType = vars.CMTargetType;
+ ppVars.Language = vars.Language;
+ ppVars.Object = "$out"; // for RULE_LAUNCH_COMPILE
+ ppVars.PreprocessedSource = "$out";
+ ppVars.DependencyFile = rule.DepFile.c_str();
+
+ // Preprocessing uses the original source, compilation uses
+ // preprocessed output or original source
+ ppVars.Source = vars.Source;
+ vars.Source = "$in";
+
+ // Copy preprocessor definitions to the preprocessor rule.
+ ppVars.Defines = vars.Defines;
+
+ // Copy include directories to the preprocessor rule. The Fortran
+ // compilation rule still needs them for the INCLUDE directive.
+ ppVars.Includes = vars.Includes;
+
+ // Preprocessing and compilation use the same flags.
+ std::string ppFlags = flags;
+
+ // If using a response file, move defines, includes, and flags into it.
+ if (!responseFlag.empty()) {
+ rule.RspFile = "$RSP_FILE";
+ rule.RspContent =
+ cmStrCat(' ', ppVars.Defines, ' ', ppVars.Includes, ' ', ppFlags);
+ ppFlags = cmStrCat(responseFlag, rule.RspFile);
+ ppVars.Defines = "";
+ ppVars.Includes = "";
+ }
+
+ ppVars.Flags = ppFlags.c_str();
+
+ // Rule for preprocessing source file.
+ std::vector<std::string> ppCmds;
+
+ if (!preprocessCommand.empty()) {
+ // Lookup the explicit preprocessing rule.
+ cmExpandList(preprocessCommand, ppCmds);
+ for (std::string& i : ppCmds) {
+ i = cmStrCat(launcher, i);
+ rulePlaceholderExpander->ExpandRuleVariables(generator, i, ppVars);
+ }
+ }
+
+ // Run CMake dependency scanner on either preprocessed output or source file
+ ppCmds.emplace_back(std::move(scanCommand));
+ rule.Command = generator->BuildCommandLine(ppCmds);
+
+ return rule;
+}
+}
+
void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
const std::string& config)
{
@@ -565,82 +660,42 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
if (explicitPP) {
- cmNinjaRule rule(this->LanguagePreprocessRule(lang, config));
- // Explicit preprocessing always uses a depfile.
- rule.DepType = ""; // no deps= for multiple outputs
- rule.DepFile = "$DEP_FILE";
+ // Combined preprocessing and dependency scanning
+ const auto ppScanCommand = GetScanCommand(
+ cmakeCmd, tdi, lang, "$out", needDyndep, "$DYNDEP_INTERMEDIATE_FILE");
+ const auto ppVar = cmStrCat("CMAKE_", lang, "_PREPROCESS_SOURCE");
- cmRulePlaceholderExpander::RuleVariables ppVars;
- ppVars.CMTargetName = vars.CMTargetName;
- ppVars.CMTargetType = vars.CMTargetType;
- ppVars.Language = vars.Language;
- ppVars.Object = "$out"; // for RULE_LAUNCH_COMPILE
- ppVars.PreprocessedSource = "$out";
- ppVars.DependencyFile = rule.DepFile.c_str();
+ auto ppRule = GetPreprocessScanRule(
+ this->LanguagePreprocessRule(lang, config), vars, responseFlag, flags,
+ launcher, rulePlaceholderExpander.get(), ppScanCommand,
+ this->GetLocalGenerator(), mf->GetRequiredDefinition(ppVar));
- // Preprocessing uses the original source,
- // compilation uses preprocessed output.
- ppVars.Source = vars.Source;
- vars.Source = "$in";
+ // Write the rule for preprocessing file of the given language.
+ ppRule.Comment = cmStrCat("Rule for preprocessing ", lang, " files.");
+ ppRule.Description = cmStrCat("Building ", lang, " preprocessed $out");
- // Preprocessing and compilation use the same flags.
- std::string ppFlags = flags;
+ this->GetGlobalGenerator()->AddRule(ppRule);
if (!compilePPWithDefines) {
- // Move preprocessor definitions to the preprocessor rule.
- ppVars.Defines = vars.Defines;
+ // Remove preprocessor definitions from compilation step
vars.Defines = "";
- } else {
- // Copy preprocessor definitions to the preprocessor rule.
- ppVars.Defines = vars.Defines;
}
- // Copy include directories to the preprocessor rule. The Fortran
- // compilation rule still needs them for the INCLUDE directive.
- ppVars.Includes = vars.Includes;
-
- // If using a response file, move defines, includes, and flags into it.
- if (!responseFlag.empty()) {
- rule.RspFile = "$RSP_FILE";
- rule.RspContent =
- cmStrCat(' ', ppVars.Defines, ' ', ppVars.Includes, ' ', ppFlags);
- ppFlags = cmStrCat(responseFlag, rule.RspFile);
- ppVars.Defines = "";
- ppVars.Includes = "";
- }
+ // Just dependency scanning for files that have preprocessing turned off
+ const auto scanCommand =
+ GetScanCommand(cmakeCmd, tdi, lang, "$in", needDyndep, "$out");
- ppVars.Flags = ppFlags.c_str();
+ auto scanRule = GetPreprocessScanRule(
+ this->LanguageDependencyRule(lang, config), vars, "", flags, launcher,
+ rulePlaceholderExpander.get(), scanCommand, this->GetLocalGenerator());
- // Rule for preprocessing source file.
- std::vector<std::string> ppCmds;
- {
- // Lookup the explicit preprocessing rule.
- std::string ppVar = cmStrCat("CMAKE_", lang, "_PREPROCESS_SOURCE");
- cmExpandList(this->GetMakefile()->GetRequiredDefinition(ppVar), ppCmds);
- }
+ // Write the rule for generating dependencies for the given language.
+ scanRule.Comment = cmStrCat("Rule for generating ", lang,
+ " dependencies on non-preprocessed files.");
+ scanRule.Description =
+ cmStrCat("Generating ", lang, " dependencies for $in");
- for (std::string& i : ppCmds) {
- i = cmStrCat(launcher, i);
- rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(),
- i, ppVars);
- }
-
- // Run CMake dependency scanner on preprocessed output.
- {
- std::string ccmd =
- cmStrCat(cmakeCmd, " -E cmake_ninja_depends --tdi=", tdi,
- " --lang=", lang, " --pp=$out --dep=$DEP_FILE");
- if (needDyndep) {
- ccmd += " --obj=$OBJ_FILE --ddi=$DYNDEP_INTERMEDIATE_FILE";
- }
- ppCmds.emplace_back(std::move(ccmd));
- }
- rule.Command = this->GetLocalGenerator()->BuildCommandLine(ppCmds);
-
- // Write the rule for preprocessing file of the given language.
- rule.Comment = cmStrCat("Rule for preprocessing ", lang, " files.");
- rule.Description = cmStrCat("Building ", lang, " preprocessed $out");
- this->GetGlobalGenerator()->AddRule(rule);
+ this->GetGlobalGenerator()->AddRule(scanRule);
}
if (needDyndep) {
@@ -996,6 +1051,82 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements(
}
}
+namespace {
+cmNinjaBuild GetPreprocessOrScanBuild(
+ const std::string& ruleName, const std::string& ppFileName, bool compilePP,
+ bool compilePPWithDefines, cmNinjaBuild& objBuild, cmNinjaVars& vars,
+ const std::string& depFileName, bool needDyndep,
+ const std::string& objectFileName)
+{
+ // Explicit preprocessing and dependency
+ cmNinjaBuild ppBuild(ruleName);
+
+ if (!ppFileName.empty()) {
+ ppBuild.Outputs.push_back(ppFileName);
+ ppBuild.RspFile = cmStrCat(ppFileName, ".rsp");
+ } else {
+ ppBuild.RspFile = "$out.rsp";
+ }
+
+ if (compilePP) {
+ // Move compilation dependencies to the preprocessing build statement.
+ std::swap(ppBuild.ExplicitDeps, objBuild.ExplicitDeps);
+ std::swap(ppBuild.ImplicitDeps, objBuild.ImplicitDeps);
+ std::swap(ppBuild.OrderOnlyDeps, objBuild.OrderOnlyDeps);
+ std::swap(ppBuild.Variables["IN_ABS"], vars["IN_ABS"]);
+
+ // The actual compilation will now use the preprocessed source.
+ objBuild.ExplicitDeps.push_back(ppFileName);
+ } else {
+ // Copy compilation dependencies to the preprocessing build statement.
+ ppBuild.ExplicitDeps = objBuild.ExplicitDeps;
+ ppBuild.ImplicitDeps = objBuild.ImplicitDeps;
+ ppBuild.OrderOnlyDeps = objBuild.OrderOnlyDeps;
+ ppBuild.Variables["IN_ABS"] = vars["IN_ABS"];
+ }
+
+ // Preprocessing and compilation generally use the same flags.
+ ppBuild.Variables["FLAGS"] = vars["FLAGS"];
+
+ if (compilePP && !compilePPWithDefines) {
+ // Move preprocessor definitions to the preprocessor build statement.
+ std::swap(ppBuild.Variables["DEFINES"], vars["DEFINES"]);
+ } else {
+ // Copy preprocessor definitions to the preprocessor build statement.
+ ppBuild.Variables["DEFINES"] = vars["DEFINES"];
+ }
+
+ // Copy include directories to the preprocessor build statement. The
+ // Fortran compilation build statement still needs them for the INCLUDE
+ // directive.
+ ppBuild.Variables["INCLUDES"] = vars["INCLUDES"];
+
+ // Explicit preprocessing always uses a depfile.
+ ppBuild.Variables["DEP_FILE"] = depFileName;
+ if (compilePP) {
+ // The actual compilation does not need a depfile because it
+ // depends on the already-preprocessed source.
+ vars.erase("DEP_FILE");
+ }
+
+ if (needDyndep) {
+ // Tell dependency scanner the object file that will result from
+ // compiling the source.
+ ppBuild.Variables["OBJ_FILE"] = objectFileName;
+
+ // Tell dependency scanner where to store dyndep intermediate results.
+ std::string const ddiFile = cmStrCat(objectFileName, ".ddi");
+ if (ppFileName.empty()) {
+ ppBuild.Outputs.push_back(ddiFile);
+ } else {
+ ppBuild.Variables["DYNDEP_INTERMEDIATE_FILE"] = ddiFile;
+ ppBuild.ImplicitOuts.push_back(ddiFile);
+ }
+ }
+ return ppBuild;
+}
+}
+
void cmNinjaTargetGenerator::WriteObjectBuildStatement(
cmSourceFile const* source, const std::string& config,
const std::string& fileConfig, bool firstForConfig)
@@ -1134,36 +1265,39 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
// For some cases we do an explicit preprocessor invocation.
bool const explicitPP = this->NeedExplicitPreprocessing(language);
if (explicitPP) {
- cmNinjaBuild ppBuild(this->LanguagePreprocessRule(language, config));
- std::string const ppFileName =
- this->ConvertToNinjaPath(this->GetPreprocessedFilePath(source, config));
- ppBuild.Outputs.push_back(ppFileName);
-
- ppBuild.RspFile = cmStrCat(ppFileName, ".rsp");
+ // If source/target has preprocessing turned off, we still need to
+ // generate an explicit dependency step
+ const auto srcpp = source->GetSafeProperty("Fortran_PREPROCESS");
+ cmOutputConverter::FortranPreprocess preprocess =
+ cmOutputConverter::GetFortranPreprocess(srcpp);
+ if (preprocess == cmOutputConverter::FortranPreprocess::Unset) {
+ const auto& tgtpp =
+ this->GeneratorTarget->GetSafeProperty("Fortran_PREPROCESS");
+ preprocess = cmOutputConverter::GetFortranPreprocess(tgtpp);
+ }
- bool const compilePP = this->UsePreprocessedSource(language);
+ bool const compilePP = this->UsePreprocessedSource(language) &&
+ (preprocess != cmOutputConverter::FortranPreprocess::NotNeeded);
bool const compilePPWithDefines =
compilePP && this->CompilePreprocessedSourceWithDefines(language);
- if (compilePP) {
- // Move compilation dependencies to the preprocessing build statement.
- std::swap(ppBuild.ExplicitDeps, objBuild.ExplicitDeps);
- std::swap(ppBuild.ImplicitDeps, objBuild.ImplicitDeps);
- std::swap(ppBuild.OrderOnlyDeps, objBuild.OrderOnlyDeps);
- std::swap(ppBuild.Variables["IN_ABS"], vars["IN_ABS"]);
-
- // The actual compilation will now use the preprocessed source.
- objBuild.ExplicitDeps.push_back(ppFileName);
- } else {
- // Copy compilation dependencies to the preprocessing build statement.
- ppBuild.ExplicitDeps = objBuild.ExplicitDeps;
- ppBuild.ImplicitDeps = objBuild.ImplicitDeps;
- ppBuild.OrderOnlyDeps = objBuild.OrderOnlyDeps;
- ppBuild.Variables["IN_ABS"] = vars["IN_ABS"];
- }
- // Preprocessing and compilation generally use the same flags.
- ppBuild.Variables["FLAGS"] = vars["FLAGS"];
+ std::string const ppFileName = compilePP
+ ? this->ConvertToNinjaPath(this->GetPreprocessedFilePath(source, config))
+ : "";
+
+ std::string const buildName = compilePP
+ ? this->LanguagePreprocessRule(language, config)
+ : this->LanguageDependencyRule(language, config);
+
+ const auto depExtension = compilePP ? ".pp.d" : ".d";
+ const std::string depFileName =
+ this->GetLocalGenerator()->ConvertToOutputFormat(
+ cmStrCat(objectFileName, depExtension), cmOutputConverter::SHELL);
+
+ cmNinjaBuild ppBuild = GetPreprocessOrScanBuild(
+ buildName, ppFileName, compilePP, compilePPWithDefines, objBuild, vars,
+ depFileName, needDyndep, objectFileName);
if (compilePP) {
// In case compilation requires flags that are incompatible with
@@ -1171,22 +1305,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
std::string const& postFlag = this->Makefile->GetSafeDefinition(
cmStrCat("CMAKE_", language, "_POSTPROCESS_FLAG"));
this->LocalGenerator->AppendFlags(vars["FLAGS"], postFlag);
- }
-
- if (compilePP && !compilePPWithDefines) {
- // Move preprocessor definitions to the preprocessor build statement.
- std::swap(ppBuild.Variables["DEFINES"], vars["DEFINES"]);
- } else {
- // Copy preprocessor definitions to the preprocessor build statement.
- ppBuild.Variables["DEFINES"] = vars["DEFINES"];
- }
-
- // Copy include directories to the preprocessor build statement. The
- // Fortran compilation build statement still needs them for the INCLUDE
- // directive.
- ppBuild.Variables["INCLUDES"] = vars["INCLUDES"];
- if (compilePP) {
// Prepend source file's original directory as an include directory
// so e.g. Fortran INCLUDE statements can look for files in it.
std::vector<std::string> sourceDirectory;
@@ -1200,28 +1319,9 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
vars["INCLUDES"] = cmStrCat(sourceDirectoryFlag, ' ', vars["INCLUDES"]);
}
- // Explicit preprocessing always uses a depfile.
- ppBuild.Variables["DEP_FILE"] =
- this->GetLocalGenerator()->ConvertToOutputFormat(
- cmStrCat(objectFileName, ".pp.d"), cmOutputConverter::SHELL);
- if (compilePP) {
- // The actual compilation does not need a depfile because it
- // depends on the already-preprocessed source.
- vars.erase("DEP_FILE");
- }
-
- if (needDyndep) {
- // Tell dependency scanner the object file that will result from
- // compiling the source.
- ppBuild.Variables["OBJ_FILE"] = objectFileName;
-
- // Tell dependency scanner where to store dyndep intermediate results.
+ if (firstForConfig && needDyndep) {
std::string const ddiFile = cmStrCat(objectFileName, ".ddi");
- ppBuild.Variables["DYNDEP_INTERMEDIATE_FILE"] = ddiFile;
- ppBuild.ImplicitOuts.push_back(ddiFile);
- if (firstForConfig) {
- this->Configs[config].DDIFiles[language].push_back(ddiFile);
- }
+ this->Configs[config].DDIFiles[language].push_back(ddiFile);
}
this->addPoolNinjaVariable("JOB_POOL_COMPILE", this->GetGeneratorTarget(),
@@ -1266,14 +1366,19 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
}
if (cmProp objectOutputs = source->GetProperty("OBJECT_OUTPUTS")) {
- cmNinjaBuild build("phony");
- build.Comment = "Additional output files.";
- build.Outputs = cmExpandedList(*objectOutputs);
- std::transform(build.Outputs.begin(), build.Outputs.end(),
- build.Outputs.begin(), MapToNinjaPath());
- build.ExplicitDeps = objBuild.Outputs;
- this->GetGlobalGenerator()->WriteBuild(this->GetImplFileStream(fileConfig),
- build);
+ std::string evaluatedObjectOutputs = cmGeneratorExpression::Evaluate(
+ *objectOutputs, this->LocalGenerator, config);
+
+ if (!evaluatedObjectOutputs.empty()) {
+ cmNinjaBuild build("phony");
+ build.Comment = "Additional output files.";
+ build.Outputs = cmExpandedList(evaluatedObjectOutputs);
+ std::transform(build.Outputs.begin(), build.Outputs.end(),
+ build.Outputs.begin(), MapToNinjaPath());
+ build.ExplicitDeps = objBuild.Outputs;
+ this->GetGlobalGenerator()->WriteBuild(
+ this->GetImplFileStream(fileConfig), build);
+ }
}
}
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index 8678dc3..8d4372e 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -12,7 +12,7 @@
#include <utility>
#include <vector>
-#include "cm_jsoncpp_value.h"
+#include <cm3p/json/value.h>
#include "cmCommonTargetGenerator.h"
#include "cmGlobalNinjaGenerator.h"
@@ -70,6 +70,8 @@ protected:
const std::string& config) const;
std::string LanguagePreprocessRule(std::string const& lang,
const std::string& config) const;
+ std::string LanguageDependencyRule(std::string const& lang,
+ const std::string& config) const;
bool NeedExplicitPreprocessing(std::string const& lang) const;
std::string LanguageDyndepRule(std::string const& lang,
const std::string& config) const;
diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx
index 134924e..b0b7953 100644
--- a/Source/cmNinjaUtilityTargetGenerator.cxx
+++ b/Source/cmNinjaUtilityTargetGenerator.cxx
@@ -160,10 +160,5 @@ void cmNinjaUtilityTargetGenerator::Generate(const std::string& config)
// be per-directory and have one at the top-level anyway.
if (genTarget->GetType() != cmStateEnums::GLOBAL_TARGET) {
gg->AddTargetAlias(this->GetTargetName(), genTarget, config);
- } else if (gg->IsMultiConfig() && genTarget->Target->IsPerConfig()) {
- cmNinjaBuild phonyAlias("phony");
- gg->AppendTargetOutputs(genTarget, phonyAlias.Outputs, "");
- phonyAlias.ExplicitDeps = phonyBuild.Outputs;
- gg->WriteBuild(this->GetImplFileStream(config), phonyAlias);
}
}
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index dc324cc..359e9f5 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -170,6 +170,17 @@ cmOutputConverter::FortranFormat cmOutputConverter::GetFortranFormat(
return format;
}
+cmOutputConverter::FortranPreprocess cmOutputConverter::GetFortranPreprocess(
+ cm::string_view value)
+{
+ if (value.empty()) {
+ return FortranPreprocess::Unset;
+ }
+
+ return cmIsOn(value) ? FortranPreprocess::Needed
+ : FortranPreprocess::NotNeeded;
+}
+
void cmOutputConverter::SetLinkScriptShell(bool linkScriptShell)
{
this->LinkScriptShell = linkScriptShell;
diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h
index 28582df..a8b4528 100644
--- a/Source/cmOutputConverter.h
+++ b/Source/cmOutputConverter.h
@@ -95,6 +95,14 @@ public:
};
static FortranFormat GetFortranFormat(cm::string_view value);
+ enum class FortranPreprocess
+ {
+ Unset,
+ NotNeeded,
+ Needed
+ };
+ static FortranPreprocess GetFortranPreprocess(cm::string_view value);
+
private:
cmState* GetState() const;
diff --git a/Source/cmPipeConnection.h b/Source/cmPipeConnection.h
index 81f8a49..1215716 100644
--- a/Source/cmPipeConnection.h
+++ b/Source/cmPipeConnection.h
@@ -6,7 +6,7 @@
#include <string>
-#include "cm_uv.h"
+#include <cm3p/uv.h>
#include "cmConnection.h"
#include "cmUVHandlePtr.h"
diff --git a/Source/cmPropertyDefinition.cxx b/Source/cmPropertyDefinition.cxx
index c8efaf6..1796bb8 100644
--- a/Source/cmPropertyDefinition.cxx
+++ b/Source/cmPropertyDefinition.cxx
@@ -2,17 +2,38 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmPropertyDefinition.h"
-#include <utility>
+#include <tuple>
-cmPropertyDefinition::cmPropertyDefinition(std::string name,
- cmProperty::ScopeType scope,
- std::string shortDescription,
+cmPropertyDefinition::cmPropertyDefinition(std::string shortDescription,
std::string fullDescription,
- bool chain)
- : Name(std::move(name))
- , ShortDescription(std::move(shortDescription))
+ bool chained)
+ : ShortDescription(std::move(shortDescription))
, FullDescription(std::move(fullDescription))
- , Scope(scope)
- , Chained(chain)
+ , Chained(chained)
{
}
+
+void cmPropertyDefinitionMap::DefineProperty(
+ const std::string& name, cmProperty::ScopeType scope,
+ const std::string& ShortDescription, const std::string& FullDescription,
+ bool chain)
+{
+ auto it = this->Map_.find(key_type(name, scope));
+ if (it == this->Map_.end()) {
+ // try_emplace() since C++17
+ this->Map_.emplace(
+ std::piecewise_construct, std::forward_as_tuple(name, scope),
+ std::forward_as_tuple(ShortDescription, FullDescription, chain));
+ }
+}
+
+cmPropertyDefinition const* cmPropertyDefinitionMap::GetPropertyDefinition(
+ const std::string& name, cmProperty::ScopeType scope) const
+{
+ auto it = this->Map_.find(key_type(name, scope));
+ if (it != this->Map_.end()) {
+ return &it->second;
+ }
+
+ return nullptr;
+}
diff --git a/Source/cmPropertyDefinition.h b/Source/cmPropertyDefinition.h
index d2e4467..f83bc4f 100644
--- a/Source/cmPropertyDefinition.h
+++ b/Source/cmPropertyDefinition.h
@@ -5,7 +5,9 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <map>
#include <string>
+#include <utility>
#include "cmProperty.h"
@@ -13,25 +15,19 @@
* \brief Property meta-information
*
* This class contains the following meta-information about property:
- * - Name;
* - Various documentation strings;
- * - The scope of the property;
* - If the property is chained.
*/
class cmPropertyDefinition
{
public:
/// Constructor
- cmPropertyDefinition(std::string name, cmProperty::ScopeType scope,
- std::string ShortDescription,
- std::string FullDescription, bool chained = false);
+ cmPropertyDefinition(std::string shortDescription,
+ std::string fullDescription, bool chained);
/// Is the property chained?
bool IsChained() const { return this->Chained; }
- /// Get the scope
- cmProperty::ScopeType GetScope() const { return this->Scope; }
-
/// Get the documentation (short version)
const std::string& GetShortDescription() const
{
@@ -44,12 +40,30 @@ public:
return this->FullDescription;
}
-protected:
- std::string Name;
+private:
std::string ShortDescription;
std::string FullDescription;
- cmProperty::ScopeType Scope;
bool Chained;
};
+/** \class cmPropertyDefinitionMap
+ * \brief Map property name and scope to their definition
+ */
+class cmPropertyDefinitionMap
+{
+public:
+ // define the property
+ void DefineProperty(const std::string& name, cmProperty::ScopeType scope,
+ const std::string& ShortDescription,
+ const std::string& FullDescription, bool chain);
+
+ // get the property definition if present, otherwise nullptr
+ cmPropertyDefinition const* GetPropertyDefinition(
+ const std::string& name, cmProperty::ScopeType scope) const;
+
+private:
+ using key_type = std::pair<std::string, cmProperty::ScopeType>;
+ std::map<key_type, cmPropertyDefinition> Map_;
+};
+
#endif
diff --git a/Source/cmPropertyDefinitionMap.cxx b/Source/cmPropertyDefinitionMap.cxx
deleted file mode 100644
index 614d5a4..0000000
--- a/Source/cmPropertyDefinitionMap.cxx
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmPropertyDefinitionMap.h"
-
-#include <tuple>
-#include <utility>
-
-void cmPropertyDefinitionMap::DefineProperty(
- const std::string& name, cmProperty::ScopeType scope,
- const std::string& ShortDescription, const std::string& FullDescription,
- bool chain)
-{
- auto it = this->find(name);
- if (it == this->end()) {
- // try_emplace() since C++17
- this->emplace(std::piecewise_construct, std::forward_as_tuple(name),
- std::forward_as_tuple(name, scope, ShortDescription,
- FullDescription, chain));
- }
-}
-
-bool cmPropertyDefinitionMap::IsPropertyDefined(const std::string& name) const
-{
- return this->find(name) != this->end();
-}
-
-bool cmPropertyDefinitionMap::IsPropertyChained(const std::string& name) const
-{
- auto it = this->find(name);
- if (it == this->end()) {
- return false;
- }
-
- return it->second.IsChained();
-}
diff --git a/Source/cmPropertyDefinitionMap.h b/Source/cmPropertyDefinitionMap.h
deleted file mode 100644
index 2ae6efb..0000000
--- a/Source/cmPropertyDefinitionMap.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmPropertyDefinitionMap_h
-#define cmPropertyDefinitionMap_h
-
-#include "cmConfigure.h" // IWYU pragma: keep
-
-#include <map>
-#include <string>
-
-#include "cmProperty.h"
-#include "cmPropertyDefinition.h"
-
-class cmPropertyDefinitionMap
- : public std::map<std::string, cmPropertyDefinition>
-{
-public:
- // define the property
- void DefineProperty(const std::string& name, cmProperty::ScopeType scope,
- const std::string& ShortDescription,
- const std::string& FullDescription, bool chain);
-
- // has a named property been defined
- bool IsPropertyDefined(const std::string& name) const;
-
- // is a named property set to chain
- bool IsPropertyChained(const std::string& name) const;
-};
-
-#endif
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 235ee38..003a300 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -18,10 +18,10 @@
#include <cm/memory>
#include <cmext/algorithm>
-#include "cmsys/SystemInformation.hxx"
+#include <cm3p/json/value.h>
+#include <cm3p/json/writer.h>
-#include "cm_jsoncpp_value.h"
-#include "cm_jsoncpp_writer.h"
+#include "cmsys/SystemInformation.hxx"
#include "cmCustomCommand.h"
#include "cmCustomCommandLines.h"
diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx
index da96305..ee2bc09 100644
--- a/Source/cmQtAutoGenerator.cxx
+++ b/Source/cmQtAutoGenerator.cxx
@@ -2,9 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmQtAutoGenerator.h"
-#include "cmsys/FStream.hxx"
+#include <cm3p/json/reader.h>
-#include "cm_jsoncpp_reader.h"
+#include "cmsys/FStream.hxx"
#include "cmQtAutoGen.h"
#include "cmStringAlgorithms.h"
diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h
index bbe6dd0..83fb3ed 100644
--- a/Source/cmQtAutoGenerator.h
+++ b/Source/cmQtAutoGenerator.h
@@ -13,7 +13,7 @@
#include <cm/string_view>
-#include "cm_jsoncpp_value.h"
+#include <cm3p/json/value.h>
#include "cmFileTime.h"
#include "cmQtAutoGen.h"
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index 36dd627..9adcabb 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -18,11 +18,11 @@
#include <cm/string_view>
#include <cmext/algorithm>
+#include <cm3p/json/value.h>
+
#include "cmsys/FStream.hxx"
#include "cmsys/RegularExpression.hxx"
-#include "cm_jsoncpp_value.h"
-
#include "cmCryptoHash.h"
#include "cmFileTime.h"
#include "cmGccDepfileReader.h"
diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx
index 434fb68..7f97406 100644
--- a/Source/cmServer.cxx
+++ b/Source/cmServer.cxx
@@ -4,6 +4,7 @@
#include <algorithm>
#include <cassert>
+#include <csignal>
#include <cstdint>
#include <iostream>
#include <mutex>
@@ -12,10 +13,10 @@
#include <cm/memory>
#include <cm/shared_mutex>
-#include "cmsys/FStream.hxx"
+#include <cm3p/json/reader.h>
+#include <cm3p/json/writer.h>
-#include "cm_jsoncpp_reader.h"
-#include "cm_jsoncpp_writer.h"
+#include "cmsys/FStream.hxx"
#include "cmConnection.h"
#include "cmFileMonitor.h"
diff --git a/Source/cmServer.h b/Source/cmServer.h
index ec40738..9543329 100644
--- a/Source/cmServer.h
+++ b/Source/cmServer.h
@@ -10,8 +10,8 @@
#include <cm/shared_mutex>
-#include "cm_jsoncpp_value.h"
-#include "cm_uv.h"
+#include <cm3p/json/value.h>
+#include <cm3p/uv.h>
#include "cmUVHandlePtr.h"
diff --git a/Source/cmServerConnection.cxx b/Source/cmServerConnection.cxx
index 2791972..b4f41a0 100644
--- a/Source/cmServerConnection.cxx
+++ b/Source/cmServerConnection.cxx
@@ -4,7 +4,7 @@
#include "cmServerConnection.h"
-#include "cm_uv.h"
+#include <cm3p/uv.h>
#include "cmServer.h"
#include "cmServerDictionary.h"
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index f6154eb..6b32de3 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -12,7 +12,7 @@
#include <cm/memory>
#include <cmext/algorithm>
-#include "cm_uv.h"
+#include <cm3p/uv.h>
#include "cmExternalMakefileProjectGenerator.h"
#include "cmFileMonitor.h"
diff --git a/Source/cmServerProtocol.h b/Source/cmServerProtocol.h
index 8446c3e..c71b7bf 100644
--- a/Source/cmServerProtocol.h
+++ b/Source/cmServerProtocol.h
@@ -8,7 +8,7 @@
#include <string>
#include <utility>
-#include "cm_jsoncpp_value.h"
+#include <cm3p/json/value.h>
#include "cmake.h"
diff --git a/Source/cmSetDirectoryPropertiesCommand.cxx b/Source/cmSetDirectoryPropertiesCommand.cxx
index 35daca6..07ad246 100644
--- a/Source/cmSetDirectoryPropertiesCommand.cxx
+++ b/Source/cmSetDirectoryPropertiesCommand.cxx
@@ -5,12 +5,6 @@
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
-namespace {
-bool RunCommand(cmMakefile& mf, std::vector<std::string>::const_iterator ait,
- std::vector<std::string>::const_iterator aitend,
- std::string& errors);
-}
-
// cmSetDirectoryPropertiesCommand
bool cmSetDirectoryPropertiesCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
@@ -20,38 +14,26 @@ bool cmSetDirectoryPropertiesCommand(std::vector<std::string> const& args,
return false;
}
- std::string errors;
- bool ret =
- RunCommand(status.GetMakefile(), args.begin() + 1, args.end(), errors);
- if (!ret) {
- status.SetError(errors);
+ // PROPERTIES followed by prop value pairs
+ if (args.size() % 2 != 1) {
+ status.SetError("Wrong number of arguments");
+ return false;
}
- return ret;
-}
-namespace {
-bool RunCommand(cmMakefile& mf, std::vector<std::string>::const_iterator ait,
- std::vector<std::string>::const_iterator aitend,
- std::string& errors)
-{
- for (; ait != aitend; ait += 2) {
- if (ait + 1 == aitend) {
- errors = "Wrong number of arguments";
- return false;
- }
- const std::string& prop = *ait;
- const std::string& value = *(ait + 1);
+ for (auto iter = args.begin() + 1; iter != args.end(); iter += 2) {
+ const std::string& prop = *iter;
if (prop == "VARIABLES") {
- errors = "Variables and cache variables should be set using SET command";
+ status.SetError(
+ "Variables and cache variables should be set using SET command");
return false;
}
if (prop == "MACROS") {
- errors = "Commands and macros cannot be set using SET_CMAKE_PROPERTIES";
+ status.SetError(
+ "Commands and macros cannot be set using SET_CMAKE_PROPERTIES");
return false;
}
- mf.SetProperty(prop, value.c_str());
+ status.GetMakefile().SetProperty(prop, (iter + 1)->c_str());
}
return true;
}
-}
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 4dbbbd7..07cb7c9 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -43,7 +43,9 @@ bool HandleSourceMode(cmExecutionStatus& status,
const std::set<std::string>& names,
const std::string& propertyName,
const std::string& propertyValue, bool appendAsString,
- bool appendMode, bool remove);
+ bool appendMode, bool remove,
+ const std::vector<cmMakefile*>& directory_makefiles,
+ bool source_file_paths_should_be_absolute);
bool HandleSource(cmSourceFile* sf, const std::string& propertyName,
const std::string& propertyValue, bool appendAsString,
bool appendMode, bool remove);
@@ -74,6 +76,131 @@ bool HandleInstall(cmInstalledFile* file, cmMakefile& makefile,
bool appendMode, bool remove);
}
+namespace SetPropertyCommand {
+bool HandleSourceFileDirectoryScopes(
+ cmExecutionStatus& status, std::vector<std::string>& source_file_directories,
+ std::vector<std::string>& source_file_target_directories,
+ std::vector<cmMakefile*>& directory_makefiles)
+{
+ cmMakefile* current_dir_mf = &status.GetMakefile();
+ if (!source_file_directories.empty()) {
+ for (const std::string& dir_path : source_file_directories) {
+ const std::string absolute_dir_path = cmSystemTools::CollapseFullPath(
+ dir_path, current_dir_mf->GetCurrentSourceDirectory());
+ cmMakefile* dir_mf =
+ status.GetMakefile().GetGlobalGenerator()->FindMakefile(
+ absolute_dir_path);
+ if (!dir_mf) {
+ status.SetError(cmStrCat("given non-existent DIRECTORY ", dir_path));
+ return false;
+ }
+ directory_makefiles.push_back(dir_mf);
+ }
+ } else if (!source_file_target_directories.empty()) {
+ for (const std::string& target_name : source_file_target_directories) {
+ cmTarget* target = current_dir_mf->FindTargetToUse(target_name);
+ if (!target) {
+ status.SetError(cmStrCat(
+ "given non-existent target for DIRECTORY_TARGET ", target_name));
+ return false;
+ }
+ cmProp target_source_dir = target->GetProperty("SOURCE_DIR");
+ cmMakefile* target_dir_mf =
+ status.GetMakefile().GetGlobalGenerator()->FindMakefile(
+ *target_source_dir);
+ directory_makefiles.push_back(target_dir_mf);
+ }
+ } else {
+ directory_makefiles.push_back(current_dir_mf);
+ }
+ return true;
+}
+
+bool HandleSourceFileDirectoryScopeValidation(
+ cmExecutionStatus& status, bool source_file_directory_option_enabled,
+ bool source_file_target_option_enabled,
+ std::vector<std::string>& source_file_directories,
+ std::vector<std::string>& source_file_target_directories)
+{
+ // Validate source file directory scopes.
+ if (source_file_directory_option_enabled &&
+ source_file_directories.empty()) {
+ std::string errors = "called with incorrect number of arguments "
+ "no value provided to the DIRECTORY option";
+ status.SetError(errors);
+ return false;
+ }
+ if (source_file_target_option_enabled &&
+ source_file_target_directories.empty()) {
+ std::string errors = "called with incorrect number of arguments "
+ "no value provided to the TARGET_DIRECTORY option";
+ status.SetError(errors);
+ return false;
+ }
+ return true;
+}
+
+bool HandleAndValidateSourceFileDirectortoryScopes(
+ cmExecutionStatus& status, bool source_file_directory_option_enabled,
+ bool source_file_target_option_enabled,
+ std::vector<std::string>& source_file_directories,
+ std::vector<std::string>& source_file_target_directories,
+ std::vector<cmMakefile*>& source_file_directory_makefiles)
+{
+ bool scope_options_valid =
+ SetPropertyCommand::HandleSourceFileDirectoryScopeValidation(
+ status, source_file_directory_option_enabled,
+ source_file_target_option_enabled, source_file_directories,
+ source_file_target_directories);
+ if (!scope_options_valid) {
+ return false;
+ }
+
+ scope_options_valid = SetPropertyCommand::HandleSourceFileDirectoryScopes(
+ status, source_file_directories, source_file_target_directories,
+ source_file_directory_makefiles);
+ return scope_options_valid;
+}
+
+std::string MakeSourceFilePathAbsoluteIfNeeded(
+ cmExecutionStatus& status, const std::string& source_file_path,
+ const bool needed)
+{
+ if (!needed) {
+ return source_file_path;
+ }
+ const std::string absolute_file_path = cmSystemTools::CollapseFullPath(
+ source_file_path, status.GetMakefile().GetCurrentSourceDirectory());
+ return absolute_file_path;
+}
+
+void MakeSourceFilePathsAbsoluteIfNeeded(
+ cmExecutionStatus& status,
+ std::vector<std::string>& source_files_absolute_paths,
+ std::vector<std::string>::const_iterator files_it_begin,
+ std::vector<std::string>::const_iterator files_it_end, const bool needed)
+{
+
+ // Make the file paths absolute, so that relative source file paths are
+ // picked up relative to the command calling site, regardless of the
+ // directory scope.
+ std::vector<std::string>::difference_type num_files =
+ files_it_end - files_it_begin;
+ source_files_absolute_paths.reserve(num_files);
+
+ if (!needed) {
+ source_files_absolute_paths.assign(files_it_begin, files_it_end);
+ return;
+ }
+
+ for (; files_it_begin != files_it_end; ++files_it_begin) {
+ const std::string absolute_file_path =
+ MakeSourceFilePathAbsoluteIfNeeded(status, *files_it_begin, true);
+ source_files_absolute_paths.push_back(absolute_file_path);
+ }
+}
+}
+
bool cmSetPropertyCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
@@ -114,13 +241,20 @@ bool cmSetPropertyCommand(std::vector<std::string> const& args,
std::string propertyName;
std::string propertyValue;
+ std::vector<std::string> source_file_directories;
+ std::vector<std::string> source_file_target_directories;
+ bool source_file_directory_option_enabled = false;
+ bool source_file_target_option_enabled = false;
+
// Parse the rest of the arguments up to the values.
enum Doing
{
DoingNone,
DoingNames,
DoingProperty,
- DoingValues
+ DoingValues,
+ DoingSourceDirectory,
+ DoingSourceTargetDirectory
};
Doing doing = DoingNames;
const char* sep = "";
@@ -137,8 +271,20 @@ bool cmSetPropertyCommand(std::vector<std::string> const& args,
appendMode = true;
remove = false;
appendAsString = true;
+ } else if (doing == DoingNames && scope == cmProperty::SOURCE_FILE &&
+ arg == "DIRECTORY") {
+ doing = DoingSourceDirectory;
+ source_file_directory_option_enabled = true;
+ } else if (doing == DoingNames && scope == cmProperty::SOURCE_FILE &&
+ arg == "TARGET_DIRECTORY") {
+ doing = DoingSourceTargetDirectory;
+ source_file_target_option_enabled = true;
} else if (doing == DoingNames) {
names.insert(arg);
+ } else if (doing == DoingSourceDirectory) {
+ source_file_directories.push_back(arg);
+ } else if (doing == DoingSourceTargetDirectory) {
+ source_file_target_directories.push_back(arg);
} else if (doing == DoingProperty) {
propertyName = arg;
doing = DoingValues;
@@ -159,6 +305,18 @@ bool cmSetPropertyCommand(std::vector<std::string> const& args,
return false;
}
+ std::vector<cmMakefile*> source_file_directory_makefiles;
+ bool file_scopes_handled =
+ SetPropertyCommand::HandleAndValidateSourceFileDirectortoryScopes(
+ status, source_file_directory_option_enabled,
+ source_file_target_option_enabled, source_file_directories,
+ source_file_target_directories, source_file_directory_makefiles);
+ if (!file_scopes_handled) {
+ return false;
+ }
+ bool source_file_paths_should_be_absolute =
+ source_file_directory_option_enabled || source_file_target_option_enabled;
+
// Dispatch property setting.
switch (scope) {
case cmProperty::GLOBAL:
@@ -172,7 +330,9 @@ bool cmSetPropertyCommand(std::vector<std::string> const& args,
appendAsString, appendMode, remove);
case cmProperty::SOURCE_FILE:
return HandleSourceMode(status, names, propertyName, propertyValue,
- appendAsString, appendMode, remove);
+ appendAsString, appendMode, remove,
+ source_file_directory_makefiles,
+ source_file_paths_should_be_absolute);
case cmProperty::TEST:
return HandleTestMode(status, names, propertyName, propertyValue,
appendAsString, appendMode, remove);
@@ -315,21 +475,32 @@ bool HandleSourceMode(cmExecutionStatus& status,
const std::set<std::string>& names,
const std::string& propertyName,
const std::string& propertyValue, bool appendAsString,
- bool appendMode, bool remove)
+ bool appendMode, bool remove,
+ const std::vector<cmMakefile*>& directory_makefiles,
+ const bool source_file_paths_should_be_absolute)
{
- for (std::string const& name : names) {
- // Get the source file.
- if (cmSourceFile* sf = status.GetMakefile().GetOrCreateSource(name)) {
- if (!HandleSource(sf, propertyName, propertyValue, appendAsString,
- appendMode, remove)) {
+ std::vector<std::string> files_absolute;
+ std::vector<std::string> unique_files(names.begin(), names.end());
+ SetPropertyCommand::MakeSourceFilePathsAbsoluteIfNeeded(
+ status, files_absolute, unique_files.begin(), unique_files.end(),
+ source_file_paths_should_be_absolute);
+
+ for (const auto mf : directory_makefiles) {
+ for (std::string const& name : files_absolute) {
+ // Get the source file.
+ if (cmSourceFile* sf = mf->GetOrCreateSource(name)) {
+ if (!HandleSource(sf, propertyName, propertyValue, appendAsString,
+ appendMode, remove)) {
+ return false;
+ }
+ } else {
+ status.SetError(cmStrCat(
+ "given SOURCE name that could not be found or created: ", name));
return false;
}
- } else {
- status.SetError(cmStrCat(
- "given SOURCE name that could not be found or created: ", name));
- return false;
}
}
+
return true;
}
diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h
index ec36f84..af566a3 100644
--- a/Source/cmSetPropertyCommand.h
+++ b/Source/cmSetPropertyCommand.h
@@ -8,9 +8,38 @@
#include <string>
#include <vector>
+class cmMakefile;
class cmExecutionStatus;
bool cmSetPropertyCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
+namespace SetPropertyCommand {
+bool HandleSourceFileDirectoryScopes(
+ cmExecutionStatus& status, std::vector<std::string>& source_file_directories,
+ std::vector<std::string>& source_file_target_directories,
+ std::vector<cmMakefile*>& directory_makefiles);
+
+bool HandleSourceFileDirectoryScopeValidation(
+ cmExecutionStatus& status, bool source_file_directory_option_enabled,
+ bool source_file_target_option_enabled,
+ std::vector<std::string>& source_file_directories,
+ std::vector<std::string>& source_file_target_directories);
+
+bool HandleAndValidateSourceFileDirectortoryScopes(
+ cmExecutionStatus& status, bool source_directories_option_encountered,
+ bool source_target_directories_option_encountered,
+ std::vector<std::string>& source_directories,
+ std::vector<std::string>& source_target_directories,
+ std::vector<cmMakefile*>& source_file_directory_makefiles);
+
+std::string MakeSourceFilePathAbsoluteIfNeeded(
+ cmExecutionStatus& status, const std::string& source_file_path, bool needed);
+void MakeSourceFilePathsAbsoluteIfNeeded(
+ cmExecutionStatus& status,
+ std::vector<std::string>& source_files_absolute_paths,
+ std::vector<std::string>::const_iterator files_it_begin,
+ std::vector<std::string>::const_iterator files_it_end, bool needed);
+}
+
#endif
diff --git a/Source/cmSetSourceFilesPropertiesCommand.cxx b/Source/cmSetSourceFilesPropertiesCommand.cxx
index 7ff604b..3135a06 100644
--- a/Source/cmSetSourceFilesPropertiesCommand.cxx
+++ b/Source/cmSetSourceFilesPropertiesCommand.cxx
@@ -2,17 +2,23 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmSetSourceFilesPropertiesCommand.h"
+#include <algorithm>
+#include <iterator>
+
+#include <cm/string_view>
+#include <cmext/algorithm>
+
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
+#include "cmSetPropertyCommand.h"
#include "cmSourceFile.h"
#include "cmStringAlgorithms.h"
-static bool RunCommand(cmMakefile* mf,
- std::vector<std::string>::const_iterator filebeg,
- std::vector<std::string>::const_iterator fileend,
- std::vector<std::string>::const_iterator propbeg,
- std::vector<std::string>::const_iterator propend,
- std::string& errors);
+static bool RunCommandForScope(
+ cmMakefile* mf, std::vector<std::string>::const_iterator file_begin,
+ std::vector<std::string>::const_iterator file_end,
+ std::vector<std::string>::const_iterator prop_begin,
+ std::vector<std::string>::const_iterator prop_end, std::string& errors);
bool cmSetSourceFilesPropertiesCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
@@ -23,56 +29,95 @@ bool cmSetSourceFilesPropertiesCommand(std::vector<std::string> const& args,
}
// break the arguments into source file names and properties
- int numFiles = 0;
- std::vector<std::string>::const_iterator j;
- j = args.begin();
// old style allows for specifier before PROPERTIES keyword
- while (j != args.end() && *j != "ABSTRACT" && *j != "WRAP_EXCLUDE" &&
- *j != "GENERATED" && *j != "COMPILE_FLAGS" &&
- *j != "OBJECT_DEPENDS" && *j != "PROPERTIES") {
- numFiles++;
- ++j;
+ static const cm::string_view prop_names[] = {
+ "ABSTRACT", "GENERATED", "WRAP_EXCLUDE", "COMPILE_FLAGS",
+ "OBJECT_DEPENDS", "PROPERTIES", "DIRECTORY", "TARGET_DIRECTORY"
+ };
+
+ auto isNotAPropertyKeyword =
+ [](const std::vector<std::string>::const_iterator& arg_it) {
+ return std::all_of(
+ std::begin(prop_names), std::end(prop_names),
+ [&arg_it](cm::string_view prop_name) { return *arg_it != prop_name; });
+ };
+
+ auto options_begin = std::find_first_of(
+ args.begin(), args.end(), std::begin(prop_names), std::end(prop_names));
+ auto options_it = options_begin;
+
+ // Handle directory options.
+ std::vector<std::string> source_file_directories;
+ std::vector<std::string> source_file_target_directories;
+ bool source_file_directory_option_enabled = false;
+ bool source_file_target_option_enabled = false;
+ std::vector<cmMakefile*> source_file_directory_makefiles;
+
+ if (options_it != args.end() && *options_it == "DIRECTORY") {
+ source_file_directory_option_enabled = true;
+ ++options_it;
+ while (options_it != args.end() && isNotAPropertyKeyword(options_it)) {
+ source_file_directories.push_back(*options_it);
+ ++options_it;
+ }
+ } else if (options_it != args.end() && *options_it == "TARGET_DIRECTORY") {
+ source_file_target_option_enabled = true;
+ ++options_it;
+ while (options_it != args.end() && isNotAPropertyKeyword(options_it)) {
+ source_file_target_directories.push_back(*options_it);
+ ++options_it;
+ }
+ }
+ const auto props_begin = options_it;
+
+ bool file_scopes_handled =
+ SetPropertyCommand::HandleAndValidateSourceFileDirectortoryScopes(
+ status, source_file_directory_option_enabled,
+ source_file_target_option_enabled, source_file_directories,
+ source_file_target_directories, source_file_directory_makefiles);
+ if (!file_scopes_handled) {
+ return false;
}
- cmMakefile& mf = status.GetMakefile();
+ std::vector<std::string> files;
+ bool source_file_paths_should_be_absolute =
+ source_file_directory_option_enabled || source_file_target_option_enabled;
+ SetPropertyCommand::MakeSourceFilePathsAbsoluteIfNeeded(
+ status, files, args.begin(), options_begin,
+ source_file_paths_should_be_absolute);
- // now call the worker function
+ // Now call the worker function for each directory scope represented by a
+ // cmMakefile instance.
std::string errors;
- bool ret = RunCommand(&mf, args.begin(), args.begin() + numFiles,
- args.begin() + numFiles, args.end(), errors);
- if (!ret) {
- status.SetError(errors);
+ for (const auto mf : source_file_directory_makefiles) {
+ bool ret = RunCommandForScope(mf, files.begin(), files.end(), props_begin,
+ args.end(), errors);
+ if (!ret) {
+ status.SetError(errors);
+ return ret;
+ }
}
- return ret;
+
+ return true;
}
-static bool RunCommand(cmMakefile* mf,
- std::vector<std::string>::const_iterator filebeg,
- std::vector<std::string>::const_iterator fileend,
- std::vector<std::string>::const_iterator propbeg,
- std::vector<std::string>::const_iterator propend,
- std::string& errors)
+static bool RunCommandForScope(
+ cmMakefile* mf, std::vector<std::string>::const_iterator file_begin,
+ std::vector<std::string>::const_iterator file_end,
+ std::vector<std::string>::const_iterator prop_begin,
+ std::vector<std::string>::const_iterator prop_end, std::string& errors)
{
std::vector<std::string> propertyPairs;
- bool generated = false;
- std::vector<std::string>::const_iterator j;
// build the property pairs
- for (j = propbeg; j != propend; ++j) {
- // old style allows for specifier before PROPERTIES keyword
- if (*j == "ABSTRACT") {
- propertyPairs.emplace_back("ABSTRACT");
- propertyPairs.emplace_back("1");
- } else if (*j == "WRAP_EXCLUDE") {
- propertyPairs.emplace_back("WRAP_EXCLUDE");
- propertyPairs.emplace_back("1");
- } else if (*j == "GENERATED") {
- generated = true;
- propertyPairs.emplace_back("GENERATED");
+ for (auto j = prop_begin; j != prop_end; ++j) {
+ // consume old style options
+ if (*j == "ABSTRACT" || *j == "GENERATED" || *j == "WRAP_EXCLUDE") {
+ propertyPairs.emplace_back(*j);
propertyPairs.emplace_back("1");
} else if (*j == "COMPILE_FLAGS") {
propertyPairs.emplace_back("COMPILE_FLAGS");
++j;
- if (j == propend) {
+ if (j == prop_end) {
errors = "called with incorrect number of arguments "
"COMPILE_FLAGS with no flags";
return false;
@@ -81,33 +126,22 @@ static bool RunCommand(cmMakefile* mf,
} else if (*j == "OBJECT_DEPENDS") {
propertyPairs.emplace_back("OBJECT_DEPENDS");
++j;
- if (j == propend) {
+ if (j == prop_end) {
errors = "called with incorrect number of arguments "
"OBJECT_DEPENDS with no dependencies";
return false;
}
propertyPairs.push_back(*j);
} else if (*j == "PROPERTIES") {
- // now loop through the rest of the arguments, new style
- ++j;
- while (j != propend) {
- propertyPairs.push_back(*j);
- if (*j == "GENERATED") {
- ++j;
- if (j != propend && cmIsOn(*j)) {
- generated = true;
- }
- } else {
- ++j;
- }
- if (j == propend) {
- errors = "called with incorrect number of arguments.";
- return false;
- }
- propertyPairs.push_back(*j);
- ++j;
+ // PROPERTIES is followed by new style prop value pairs
+ cmStringRange newStyleProps{ j + 1, prop_end };
+ if (newStyleProps.size() % 2 != 0) {
+ errors = "called with incorrect number of arguments.";
+ return false;
}
- // break out of the loop because j is already == end
+ // set newStyleProps as is.
+ cm::append(propertyPairs, newStyleProps);
+ // break out of the loop.
break;
} else {
errors = "called with illegal arguments, maybe missing a "
@@ -116,15 +150,13 @@ static bool RunCommand(cmMakefile* mf,
}
}
- // now loop over all the files
- for (j = filebeg; j != fileend; ++j) {
+ // loop over all the files
+ for (const std::string& sfname : cmStringRange{ file_begin, file_end }) {
// get the source file
- cmSourceFile* sf = mf->GetOrCreateSource(*j, generated);
- if (sf) {
- // now loop through all the props and set them
- unsigned int k;
- for (k = 0; k < propertyPairs.size(); k = k + 2) {
- sf->SetProperty(propertyPairs[k], propertyPairs[k + 1].c_str());
+ if (cmSourceFile* sf = mf->GetOrCreateSource(sfname)) {
+ // loop through the props and set them
+ for (auto k = propertyPairs.begin(); k != propertyPairs.end(); k += 2) {
+ sf->SetProperty(*k, (k + 1)->c_str());
}
}
}
diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx
index cd0fa40..bdc84af 100644
--- a/Source/cmSetTargetPropertiesCommand.cxx
+++ b/Source/cmSetTargetPropertiesCommand.cxx
@@ -2,19 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmSetTargetPropertiesCommand.h"
+#include <algorithm>
#include <iterator>
-#include <cmext/algorithm>
-
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmStringAlgorithms.h"
#include "cmTarget.h"
-static bool SetOneTarget(const std::string& tname,
- std::vector<std::string>& propertyPairs,
- cmMakefile* mf);
-
bool cmSetTargetPropertiesCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
@@ -23,61 +18,38 @@ bool cmSetTargetPropertiesCommand(std::vector<std::string> const& args,
return false;
}
- // first collect up the list of files
- std::vector<std::string> propertyPairs;
- int numFiles = 0;
- for (auto j = args.begin(); j != args.end(); ++j) {
- if (*j == "PROPERTIES") {
- // now loop through the rest of the arguments, new style
- ++j;
- if (std::distance(j, args.end()) % 2 != 0) {
- status.SetError("called with incorrect number of arguments.");
- return false;
- }
- cm::append(propertyPairs, j, args.end());
- break;
- }
- numFiles++;
+ // first identify the properties arguments
+ auto propsIter = std::find(args.begin(), args.end(), "PROPERTIES");
+ if (propsIter == args.end() || propsIter + 1 == args.end()) {
+ status.SetError("called with illegal arguments, maybe missing a "
+ "PROPERTIES specifier?");
+ return false;
}
- if (propertyPairs.empty()) {
- status.SetError("called with illegal arguments, maybe missing "
- "a PROPERTIES specifier?");
+
+ if (std::distance(propsIter, args.end()) % 2 != 1) {
+ status.SetError("called with incorrect number of arguments.");
return false;
}
cmMakefile& mf = status.GetMakefile();
- // now loop over all the targets
- for (int i = 0; i < numFiles; ++i) {
- if (mf.IsAlias(args[i])) {
+ // loop over all the targets
+ for (const std::string& tname : cmStringRange{ args.begin(), propsIter }) {
+ if (mf.IsAlias(tname)) {
status.SetError("can not be used on an ALIAS target.");
return false;
}
- bool ret = SetOneTarget(args[i], propertyPairs, &mf);
- if (!ret) {
+ if (cmTarget* target = mf.FindTargetToUse(tname)) {
+ // loop through all the props and set them
+ for (auto k = propsIter + 1; k != args.end(); k += 2) {
+ target->SetProperty(*k, *(k + 1));
+ target->CheckProperty(*k, &mf);
+ }
+ } else {
status.SetError(
- cmStrCat("Can not find target to add properties to: ", args[i]));
+ cmStrCat("Can not find target to add properties to: ", tname));
return false;
}
}
return true;
}
-
-static bool SetOneTarget(const std::string& tname,
- std::vector<std::string>& propertyPairs,
- cmMakefile* mf)
-{
- if (cmTarget* target = mf->FindTargetToUse(tname)) {
- // now loop through all the props and set them
- unsigned int k;
- for (k = 0; k < propertyPairs.size(); k = k + 2) {
- target->SetProperty(propertyPairs[k], propertyPairs[k + 1]);
- target->CheckProperty(propertyPairs[k], mf);
- }
- }
- // if file is not already in the makefile, then add it
- else {
- return false;
- }
- return true;
-}
diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx
index 2e7aeca..c4bff76 100644
--- a/Source/cmSetTestsPropertiesCommand.cxx
+++ b/Source/cmSetTestsPropertiesCommand.cxx
@@ -2,19 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmSetTestsPropertiesCommand.h"
+#include <algorithm>
#include <iterator>
-#include <cmext/algorithm>
-
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmStringAlgorithms.h"
#include "cmTest.h"
-static bool SetOneTest(const std::string& tname,
- std::vector<std::string>& propertyPairs, cmMakefile* mf,
- std::string& errors);
-
bool cmSetTestsPropertiesCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
@@ -23,61 +18,33 @@ bool cmSetTestsPropertiesCommand(std::vector<std::string> const& args,
return false;
}
- cmMakefile& mf = status.GetMakefile();
-
- // first collect up the list of files
- std::vector<std::string> propertyPairs;
- int numFiles = 0;
- std::vector<std::string>::const_iterator j;
- for (j = args.begin(); j != args.end(); ++j) {
- if (*j == "PROPERTIES") {
- // now loop through the rest of the arguments, new style
- ++j;
- if (std::distance(j, args.end()) % 2 != 0) {
- status.SetError("called with incorrect number of arguments.");
- return false;
- }
- cm::append(propertyPairs, j, args.end());
- break;
- }
- numFiles++;
- }
- if (propertyPairs.empty()) {
- status.SetError("called with illegal arguments, maybe "
- "missing a PROPERTIES specifier?");
+ // first identify the properties arguments
+ auto propsIter = std::find(args.begin(), args.end(), "PROPERTIES");
+ if (propsIter == args.end() || propsIter + 1 == args.end()) {
+ status.SetError("called with illegal arguments, maybe missing a "
+ "PROPERTIES specifier?");
return false;
}
- // now loop over all the targets
- int i;
- for (i = 0; i < numFiles; ++i) {
- std::string errors;
- bool ret = SetOneTest(args[i], propertyPairs, &mf, errors);
- if (!ret) {
- status.SetError(errors);
- return ret;
- }
+ if (std::distance(propsIter, args.end()) % 2 != 1) {
+ status.SetError("called with incorrect number of arguments.");
+ return false;
}
- return true;
-}
-
-static bool SetOneTest(const std::string& tname,
- std::vector<std::string>& propertyPairs, cmMakefile* mf,
- std::string& errors)
-{
- if (cmTest* test = mf->GetTest(tname)) {
- // now loop through all the props and set them
- unsigned int k;
- for (k = 0; k < propertyPairs.size(); k = k + 2) {
- if (!propertyPairs[k].empty()) {
- test->SetProperty(propertyPairs[k], propertyPairs[k + 1].c_str());
+ // loop over all the tests
+ for (const std::string& tname : cmStringRange{ args.begin(), propsIter }) {
+ if (cmTest* test = status.GetMakefile().GetTest(tname)) {
+ // loop through all the props and set them
+ for (auto k = propsIter + 1; k != args.end(); k += 2) {
+ if (!k->empty()) {
+ test->SetProperty(*k, (k + 1)->c_str());
+ }
}
+ } else {
+ status.SetError(
+ cmStrCat("Can not find test to add properties to: ", tname));
+ return false;
}
- } else {
- errors = cmStrCat("Can not find test to add properties to: ", tname);
- return false;
}
-
return true;
}
diff --git a/Source/cmStandardLexer.h b/Source/cmStandardLexer.h
index 55d23c1..cc67ac2 100644
--- a/Source/cmStandardLexer.h
+++ b/Source/cmStandardLexer.h
@@ -63,7 +63,7 @@
#define YY_NO_UNPUT 1
#define ECHO
-#include "cm_kwiml.h"
+#include <cm3p/kwiml/int.h>
typedef KWIML_INT_int8_t flex_int8_t;
typedef KWIML_INT_uint8_t flex_uint8_t;
typedef KWIML_INT_int16_t flex_int16_t;
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index df013f4..18d8537 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -265,7 +265,7 @@ void cmState::RemoveCacheEntryProperty(std::string const& key,
cmStateSnapshot cmState::Reset()
{
this->GlobalProperties.Clear();
- this->PropertyDefinitions.clear();
+ this->PropertyDefinitions = {};
this->GlobVerificationManager->Reset();
cmStateDetail::PositionType pos = this->SnapshotData.Truncate();
@@ -331,39 +331,23 @@ void cmState::DefineProperty(const std::string& name,
const std::string& ShortDescription,
const std::string& FullDescription, bool chained)
{
- this->PropertyDefinitions[scope].DefineProperty(
- name, scope, ShortDescription, FullDescription, chained);
+ this->PropertyDefinitions.DefineProperty(name, scope, ShortDescription,
+ FullDescription, chained);
}
cmPropertyDefinition const* cmState::GetPropertyDefinition(
const std::string& name, cmProperty::ScopeType scope) const
{
- if (this->IsPropertyDefined(name, scope)) {
- cmPropertyDefinitionMap const& defs =
- this->PropertyDefinitions.find(scope)->second;
- return &defs.find(name)->second;
- }
- return nullptr;
-}
-
-bool cmState::IsPropertyDefined(const std::string& name,
- cmProperty::ScopeType scope) const
-{
- auto it = this->PropertyDefinitions.find(scope);
- if (it == this->PropertyDefinitions.end()) {
- return false;
- }
- return it->second.IsPropertyDefined(name);
+ return this->PropertyDefinitions.GetPropertyDefinition(name, scope);
}
bool cmState::IsPropertyChained(const std::string& name,
cmProperty::ScopeType scope) const
{
- auto it = this->PropertyDefinitions.find(scope);
- if (it == this->PropertyDefinitions.end()) {
- return false;
+ if (auto def = this->GetPropertyDefinition(name, scope)) {
+ return def->IsChained();
}
- return it->second.IsPropertyChained(name);
+ return false;
}
void cmState::SetLanguageEnabled(std::string const& l)
diff --git a/Source/cmState.h b/Source/cmState.h
index e966935..f2bd32a 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -17,7 +17,7 @@
#include "cmListFileCache.h"
#include "cmPolicies.h"
#include "cmProperty.h"
-#include "cmPropertyDefinitionMap.h"
+#include "cmPropertyDefinition.h"
#include "cmPropertyMap.h"
#include "cmStatePrivate.h"
#include "cmStateTypes.h"
@@ -25,7 +25,6 @@
class cmCacheManager;
class cmCommand;
class cmGlobVerificationManager;
-class cmPropertyDefinition;
class cmStateSnapshot;
class cmMessenger;
class cmExecutionStatus;
@@ -131,9 +130,6 @@ public:
cmPropertyDefinition const* GetPropertyDefinition(
const std::string& name, cmProperty::ScopeType scope) const;
- // Is a property defined?
- bool IsPropertyDefined(const std::string& name,
- cmProperty::ScopeType scope) const;
bool IsPropertyChained(const std::string& name,
cmProperty::ScopeType scope) const;
@@ -225,7 +221,7 @@ private:
const std::string& variable,
cmListFileBacktrace const& bt);
- std::map<cmProperty::ScopeType, cmPropertyDefinitionMap> PropertyDefinitions;
+ cmPropertyDefinitionMap PropertyDefinitions;
std::vector<std::string> EnabledLanguages;
std::map<std::string, Command> BuiltinCommands;
std::map<std::string, Command> ScriptedCommands;
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 23b099a..be799b0 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -14,7 +14,7 @@
#include <cmext/algorithm>
-#include "cm_uv.h"
+#include <cm3p/uv.h>
#include "cmDuration.h"
#include "cmProcessOutput.h"
@@ -22,7 +22,8 @@
#include "cmStringAlgorithms.h"
#if !defined(CMAKE_BOOTSTRAP)
-# include "cm_libarchive.h"
+# include <cm3p/archive.h>
+# include <cm3p/archive_entry.h>
# include "cmArchiveWrite.h"
# include "cmLocale.h"
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index a776398..4bb48fb 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -215,7 +215,7 @@ public:
};
cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
- Visibility vis, cmMakefile* mf, bool perConfig)
+ Visibility vis, cmMakefile* mf, PerConfig perConfig)
: impl(cm::make_unique<cmTargetInternals>())
{
assert(mf);
@@ -231,7 +231,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
(vis == VisibilityImported || vis == VisibilityImportedGlobally);
impl->ImportedGloballyVisible = vis == VisibilityImportedGlobally;
impl->BuildInterfaceIncludesAppended = false;
- impl->PerConfig = perConfig;
+ impl->PerConfig = (perConfig == PerConfig::Yes);
// Check whether this is a DLL platform.
impl->IsDLLPlatform =
@@ -307,6 +307,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
initProp("Fortran_FORMAT");
initProp("Fortran_MODULE_DIRECTORY");
initProp("Fortran_COMPILER_LAUNCHER");
+ initProp("Fortran_PREPROCESS");
initProp("GNUtoMS");
initProp("OSX_ARCHITECTURES");
initProp("IOS_INSTALL_COMBINED");
@@ -372,6 +373,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
initProp("DISABLE_PRECOMPILE_HEADERS");
initProp("UNITY_BUILD");
initPropValue("UNITY_BUILD_BATCH_SIZE", "8");
+ initPropValue("UNITY_BUILD_MODE", "BATCH");
initPropValue("PCH_WARN_INVALID", "ON");
#ifdef __APPLE__
if (this->GetGlobalGenerator()->IsXcode()) {
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 8fecd41..6bd47f7 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -45,8 +45,14 @@ public:
VisibilityImportedGlobally
};
+ enum class PerConfig
+ {
+ Yes,
+ No
+ };
+
cmTarget(std::string const& name, cmStateEnums::TargetType type,
- Visibility vis, cmMakefile* mf, bool perConfig);
+ Visibility vis, cmMakefile* mf, PerConfig perConfig);
cmTarget(cmTarget const&) = delete;
cmTarget(cmTarget&&) noexcept;
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 025a7b3..4e41993 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -76,7 +76,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
cmGeneratorExpression ge(this->Test->GetBacktrace());
// Start the test command.
- os << indent << "add_test(" << this->Test->GetName() << " ";
+ os << indent << "add_test(\"" << this->Test->GetName() << "\" ";
// Evaluate command line arguments
std::vector<std::string> argv =
@@ -126,8 +126,8 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
os << ")\n";
// Output properties for the test.
- os << indent << "set_tests_properties(" << this->Test->GetName()
- << " PROPERTIES ";
+ os << indent << "set_tests_properties(\"" << this->Test->GetName()
+ << "\" PROPERTIES ";
for (auto const& i : this->Test->GetProperties().GetList()) {
os << " " << i.first << " "
<< cmOutputConverter::EscapeForCMake(
@@ -139,7 +139,8 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
void cmTestGenerator::GenerateScriptNoConfig(std::ostream& os, Indent indent)
{
- os << indent << "add_test(" << this->Test->GetName() << " NOT_AVAILABLE)\n";
+ os << indent << "add_test(\"" << this->Test->GetName()
+ << "\" NOT_AVAILABLE)\n";
}
bool cmTestGenerator::NeedsScriptNoConfig() const
@@ -159,9 +160,8 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout, Indent indent)
std::string exe = command[0];
cmSystemTools::ConvertToUnixSlashes(exe);
- fout << indent;
- fout << "add_test(";
- fout << this->Test->GetName() << " \"" << exe << "\"";
+ fout << indent << "add_test(\"" << this->Test->GetName() << "\" \"" << exe
+ << "\"";
for (std::string const& arg : cmMakeRange(command).advance(1)) {
// Just double-quote all arguments so they are re-parsed
diff --git a/Source/cmUVHandlePtr.cxx b/Source/cmUVHandlePtr.cxx
index 23dabb7..df2f64e 100644
--- a/Source/cmUVHandlePtr.cxx
+++ b/Source/cmUVHandlePtr.cxx
@@ -7,7 +7,7 @@
#include <cstdlib>
#include <mutex>
-#include "cm_uv.h"
+#include <cm3p/uv.h>
namespace cm {
diff --git a/Source/cmUVHandlePtr.h b/Source/cmUVHandlePtr.h
index 3083b60..d9de7f3 100644
--- a/Source/cmUVHandlePtr.h
+++ b/Source/cmUVHandlePtr.h
@@ -8,7 +8,7 @@
#include <memory>
#include <type_traits>
-#include "cm_uv.h"
+#include <cm3p/uv.h>
#if defined(__SUNPRO_CC)
diff --git a/Source/cmUVProcessChain.cxx b/Source/cmUVProcessChain.cxx
index 543c330..6040fd8 100644
--- a/Source/cmUVProcessChain.cxx
+++ b/Source/cmUVProcessChain.cxx
@@ -9,7 +9,7 @@
#include <cm/memory>
-#include "cm_uv.h"
+#include <cm3p/uv.h>
#include "cmGetPipes.h"
#include "cmUVHandlePtr.h"
diff --git a/Source/cmUVProcessChain.h b/Source/cmUVProcessChain.h
index cd7397e..b5ccb19 100644
--- a/Source/cmUVProcessChain.h
+++ b/Source/cmUVProcessChain.h
@@ -11,7 +11,7 @@
#include <string>
#include <vector>
-#include "cm_uv.h"
+#include <cm3p/uv.h>
class cmUVProcessChain;
diff --git a/Source/cmUVSignalHackRAII.h b/Source/cmUVSignalHackRAII.h
index 63599db..60e4ca8 100644
--- a/Source/cmUVSignalHackRAII.h
+++ b/Source/cmUVSignalHackRAII.h
@@ -3,7 +3,7 @@
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
-#include "cm_uv.h"
+#include <cm3p/uv.h>
#if defined(CMAKE_USE_SYSTEM_LIBUV) && !defined(_WIN32) && \
UV_VERSION_MAJOR == 1 && UV_VERSION_MINOR < 19
diff --git a/Source/cmUVStreambuf.h b/Source/cmUVStreambuf.h
index 1c8a771..50faede 100644
--- a/Source/cmUVStreambuf.h
+++ b/Source/cmUVStreambuf.h
@@ -8,7 +8,7 @@
#include <streambuf>
#include <vector>
-#include "cm_uv.h"
+#include <cm3p/uv.h>
#include "cmUVHandlePtr.h"
diff --git a/Source/cmVSSetupHelper.h b/Source/cmVSSetupHelper.h
index 0980cef..a2fd3d5 100644
--- a/Source/cmVSSetupHelper.h
+++ b/Source/cmVSSetupHelper.h
@@ -8,13 +8,12 @@
#endif
// Published by Visual Studio Setup team
+#include <cm3p/Setup.Configuration.h>
#include <string>
#include <vector>
#include <windows.h>
-#include "cmvssetup/Setup.Configuration.h"
-
template <class T>
class SmartCOMPtr
{
diff --git a/Source/cmVersion.h b/Source/cmVersion.h
index bfd994d..932ef04 100644
--- a/Source/cmVersion.h
+++ b/Source/cmVersion.h
@@ -3,7 +3,7 @@
#ifndef cmVersion_h
#define cmVersion_h
-#include "cm_kwiml.h"
+#include <cm3p/kwiml/int.h>
/** \class cmVersion
* \brief Helper class for providing CMake and CTest version information.
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 2b20a00..de88182 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -248,6 +248,7 @@ cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator(
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
this->InSourceBuild = (this->Makefile->GetCurrentSourceDirectory() ==
this->Makefile->GetCurrentBinaryDirectory());
+ this->ClassifyAllConfigSources();
}
cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator()
@@ -921,13 +922,11 @@ void cmVisualStudio10TargetGenerator::WriteDotNetDocumentationFile(Elem& e0)
void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup(Elem& e0)
{
- std::vector<cmSourceFile const*> resxObjs;
- this->GeneratorTarget->GetResxSources(resxObjs, "");
- if (!resxObjs.empty()) {
+ if (!this->ResxObjs.empty()) {
Elem e1(e0, "ItemGroup");
std::string srcDir = this->Makefile->GetCurrentSourceDirectory();
ConvertToWindowsSlash(srcDir);
- for (cmSourceFile const* oi : resxObjs) {
+ for (cmSourceFile const* oi : this->ResxObjs) {
std::string obj = oi->GetFullPath();
ConvertToWindowsSlash(obj);
bool useRelativePath = false;
@@ -1016,11 +1015,9 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup(Elem& e0)
void cmVisualStudio10TargetGenerator::WriteXamlFilesGroup(Elem& e0)
{
- std::vector<cmSourceFile const*> xamlObjs;
- this->GeneratorTarget->GetXamlSources(xamlObjs, "");
- if (!xamlObjs.empty()) {
+ if (!this->XamlObjs.empty()) {
Elem e1(e0, "ItemGroup");
- for (cmSourceFile const* oi : xamlObjs) {
+ for (cmSourceFile const* oi : this->XamlObjs) {
std::string obj = oi->GetFullPath();
std::string xamlType;
cmProp xamlTypeProperty = oi->GetProperty("VS_XAML_TYPE");
@@ -1329,21 +1326,27 @@ void cmVisualStudio10TargetGenerator::WriteNsightTegraConfigurationValues(
void cmVisualStudio10TargetGenerator::WriteCustomCommands(Elem& e0)
{
this->CSharpCustomCommandNames.clear();
- std::vector<cmSourceFile const*> customCommands;
- this->GeneratorTarget->GetCustomCommands(customCommands, "");
- for (cmSourceFile const* si : customCommands) {
- this->WriteCustomCommand(e0, si);
+
+ cmSourceFile const* srcCMakeLists =
+ this->LocalGenerator->CreateVCProjBuildRule();
+
+ for (cmGeneratorTarget::AllConfigSource const& si :
+ this->GeneratorTarget->GetAllConfigSources()) {
+ if (si.Source == srcCMakeLists) {
+ // Skip explicit reference to CMakeLists.txt source.
+ continue;
+ }
+ this->WriteCustomCommand(e0, si.Source);
}
// Add CMakeLists.txt file with rule to re-run CMake for user convenience.
if (this->GeneratorTarget->GetType() != cmStateEnums::GLOBAL_TARGET &&
this->GeneratorTarget->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) {
- if (cmSourceFile const* sf =
- this->LocalGenerator->CreateVCProjBuildRule()) {
+ if (srcCMakeLists) {
// Write directly rather than through WriteCustomCommand because
// we do not want the de-duplication and it has no dependencies.
- if (cmCustomCommand const* command = sf->GetCustomCommand()) {
- this->WriteCustomRule(e0, sf, *command);
+ if (cmCustomCommand const* command = srcCMakeLists->GetCustomCommand()) {
+ this->WriteCustomRule(e0, srcCMakeLists, *command);
}
}
}
@@ -1624,11 +1627,9 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
}
}
- std::vector<cmSourceFile const*> resxObjs;
- this->GeneratorTarget->GetResxSources(resxObjs, "");
- if (!resxObjs.empty()) {
+ if (!this->ResxObjs.empty()) {
Elem e1(e0, "ItemGroup");
- for (cmSourceFile const* oi : resxObjs) {
+ for (cmSourceFile const* oi : this->ResxObjs) {
std::string obj = oi->GetFullPath();
ConvertToWindowsSlash(obj);
Elem e2(e1, "EmbeddedResource");
@@ -1656,7 +1657,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
}
}
- if (!resxObjs.empty() || !this->AddedFiles.empty()) {
+ if (!this->ResxObjs.empty() || !this->AddedFiles.empty()) {
std::string guidName = "SG_Filter_Resource Files";
std::string guid = this->GlobalGenerator->GetGUID(guidName);
Elem e2(e1, "Filter");
@@ -2209,10 +2210,10 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
}
} break;
case cmGeneratorTarget::SourceKindResx:
- // Handled elsewhere.
+ this->ResxObjs.push_back(si.Source);
break;
case cmGeneratorTarget::SourceKindXaml:
- // Handled elsewhere.
+ this->XamlObjs.push_back(si.Source);
break;
}
@@ -2317,21 +2318,13 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
cmGeneratorExpression::Find(*cincludes) != std::string::npos;
includes += *cincludes;
}
- std::string lang =
- this->GlobalGenerator->GetLanguageFromExtension(sf.GetExtension().c_str());
- std::string sourceLang = this->LocalGenerator->GetSourceFileLanguage(sf);
- const std::string& linkLanguage =
- this->GeneratorTarget->GetLinkerLanguage("");
- bool needForceLang = false;
- // source file does not match its extension language
- if (lang != sourceLang) {
- needForceLang = true;
- lang = sourceLang;
- }
- // if the source file does not match the linker language
- // then force c or c++
+
+ // Force language if the file extension does not match.
+ std::string lang = this->LocalGenerator->GetSourceFileLanguage(sf);
const char* compileAs = 0;
- if (needForceLang || (linkLanguage != lang)) {
+ if (lang !=
+ this->GlobalGenerator->GetLanguageFromExtension(
+ sf.GetExtension().c_str())) {
if (lang == "CXX") {
// force a C++ file type
compileAs = "CompileAsCpp";
@@ -2340,6 +2333,7 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
compileAs = "CompileAsC";
}
}
+
bool noWinRT = this->TargetCompileAsWinRT && lang == "C";
// for the first time we need a new line if there is something
// produced here.
@@ -2376,7 +2370,7 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
pchOptions =
this->GeneratorTarget->GetPchUseCompileOptions(config, lang);
}
- customAndPchOptions += pchOptions;
+ customAndPchOptions = cmStrCat(customAndPchOptions, ';', pchOptions);
}
// if we have flags or defines for this config then
@@ -2736,13 +2730,6 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget,
langForClCompile, configName);
}
- // set the correct language
- if (linkLanguage == "C") {
- clOptions.AddFlag("CompileAs", "CompileAsC");
- }
- if (linkLanguage == "CXX") {
- clOptions.AddFlag("CompileAs", "CompileAsCpp");
- }
// Put the IPO enabled configurations into a set.
if (this->GeneratorTarget->IsIPOEnabled(linkLanguage, configName)) {
@@ -3143,6 +3130,17 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions(
cudaOptions.AddIncludes(this->GetIncludes(configName, "CUDA"));
cudaOptions.AddFlag("UseHostInclude", "false");
+ // Add runtime library selection flag.
+ std::string const& cudaRuntime =
+ this->GeneratorTarget->GetRuntimeLinkLibrary("CUDA", configName);
+ if (cudaRuntime == "STATIC") {
+ cudaOptions.AddFlag("CudaRuntime", "Static");
+ } else if (cudaRuntime == "SHARED") {
+ cudaOptions.AddFlag("CudaRuntime", "Shared");
+ } else if (cudaRuntime == "NONE") {
+ cudaOptions.AddFlag("CudaRuntime", "None");
+ }
+
this->CudaOptions[configName] = std::move(pOptions);
return true;
}
@@ -3493,12 +3491,12 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
// its location as the root source directory.
std::string rootDir = this->LocalGenerator->GetCurrentSourceDirectory();
{
- std::vector<cmSourceFile const*> extraSources;
- this->GeneratorTarget->GetExtraSources(extraSources, "");
- for (cmSourceFile const* si : extraSources) {
- if ("androidmanifest.xml" ==
- cmSystemTools::LowerCase(si->GetLocation().GetName())) {
- rootDir = si->GetLocation().GetDirectory();
+ for (cmGeneratorTarget::AllConfigSource const& source :
+ this->GeneratorTarget->GetAllConfigSources()) {
+ if (source.Kind == cmGeneratorTarget::SourceKindExtra &&
+ "androidmanifest.xml" ==
+ cmSystemTools::LowerCase(source.Source->GetLocation().GetName())) {
+ rootDir = source.Source->GetLocation().GetDirectory();
break;
}
}
@@ -3657,10 +3655,6 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
std::vector<std::string> libVec;
std::vector<std::string> vsTargetVec;
this->AddLibraries(cli, libVec, vsTargetVec, config);
- if (cm::contains(linkClosure->Languages, "CUDA") &&
- this->CudaOptions[config] != nullptr) {
- this->CudaOptions[config]->FixCudaRuntime(this->GeneratorTarget);
- }
std::string standardLibsVar =
cmStrCat("CMAKE_", linkLanguage, "_STANDARD_LIBRARIES");
std::string const& libs = this->Makefile->GetSafeDefinition(standardLibsVar);
@@ -4133,7 +4127,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0)
}
// Don't reference targets that don't produce any output.
- if (dt->GetManagedType("") == cmGeneratorTarget::ManagedType::Undefined) {
+ if (dt->GetManagedType(this->Configurations[0]) ==
+ cmGeneratorTarget::ManagedType::Undefined) {
e2.Element("ReferenceOutputAssembly", "false");
e2.Element("CopyToOutputDirectory", "Never");
}
@@ -4234,12 +4229,13 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile(
this->GlobalGenerator->TargetsWindowsPhone()) &&
(cmStateEnums::EXECUTABLE == this->GeneratorTarget->GetType())) {
std::string pfxFile;
- std::vector<cmSourceFile const*> certificates;
- this->GeneratorTarget->GetCertificates(certificates, "");
- for (cmSourceFile const* si : certificates) {
- pfxFile = this->ConvertPath(si->GetFullPath(), false);
- ConvertToWindowsSlash(pfxFile);
- break;
+ for (cmGeneratorTarget::AllConfigSource const& source :
+ this->GeneratorTarget->GetAllConfigSources()) {
+ if (source.Kind == cmGeneratorTarget::SourceKindCertificate) {
+ pfxFile = this->ConvertPath(source.Source->GetFullPath(), false);
+ ConvertToWindowsSlash(pfxFile);
+ break;
+ }
}
if (this->IsMissingFiles &&
@@ -4285,28 +4281,61 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile(
}
}
+void cmVisualStudio10TargetGenerator::ClassifyAllConfigSources()
+{
+ for (cmGeneratorTarget::AllConfigSource const& source :
+ this->GeneratorTarget->GetAllConfigSources()) {
+ this->ClassifyAllConfigSource(source);
+ }
+}
+
+void cmVisualStudio10TargetGenerator::ClassifyAllConfigSource(
+ cmGeneratorTarget::AllConfigSource const& acs)
+{
+ switch (acs.Kind) {
+ case cmGeneratorTarget::SourceKindResx: {
+ // Build and save the name of the corresponding .h file
+ // This relationship will be used later when building the project files.
+ // Both names would have been auto generated from Visual Studio
+ // where the user supplied the file name and Visual Studio
+ // appended the suffix.
+ std::string resx = acs.Source->ResolveFullPath();
+ std::string hFileName = resx.substr(0, resx.find_last_of('.')) + ".h";
+ this->ExpectedResxHeaders.insert(hFileName);
+ } break;
+ case cmGeneratorTarget::SourceKindXaml: {
+ // Build and save the name of the corresponding .h and .cpp file
+ // This relationship will be used later when building the project files.
+ // Both names would have been auto generated from Visual Studio
+ // where the user supplied the file name and Visual Studio
+ // appended the suffix.
+ std::string xaml = acs.Source->ResolveFullPath();
+ std::string hFileName = xaml + ".h";
+ std::string cppFileName = xaml + ".cpp";
+ this->ExpectedXamlHeaders.insert(hFileName);
+ this->ExpectedXamlSources.insert(cppFileName);
+ } break;
+ default:
+ break;
+ }
+}
+
bool cmVisualStudio10TargetGenerator::IsResxHeader(
const std::string& headerFile)
{
- std::set<std::string> expectedResxHeaders;
- this->GeneratorTarget->GetExpectedResxHeaders(expectedResxHeaders, "");
- return expectedResxHeaders.count(headerFile) > 0;
+ return this->ExpectedResxHeaders.count(headerFile) > 0;
}
bool cmVisualStudio10TargetGenerator::IsXamlHeader(
const std::string& headerFile)
{
- std::set<std::string> expectedXamlHeaders;
- this->GeneratorTarget->GetExpectedXamlHeaders(expectedXamlHeaders, "");
- return expectedXamlHeaders.count(headerFile) > 0;
+ return this->ExpectedXamlHeaders.count(headerFile) > 0;
}
bool cmVisualStudio10TargetGenerator::IsXamlSource(
const std::string& sourceFile)
{
- std::set<std::string> expectedXamlSources;
- this->GeneratorTarget->GetExpectedXamlSources(expectedXamlSources, "");
- return expectedXamlSources.count(sourceFile) > 0;
+ return this->ExpectedXamlSources.count(sourceFile) > 0;
}
void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings(Elem& e1)
@@ -4387,39 +4416,38 @@ void cmVisualStudio10TargetGenerator::VerifyNecessaryFiles()
// For Windows and Windows Phone executables, we will assume that if a
// manifest is not present that we need to add all the necessary files
if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) {
- std::vector<cmSourceFile const*> manifestSources;
- this->GeneratorTarget->GetAppManifest(manifestSources, "");
- {
- std::string const& v = this->GlobalGenerator->GetSystemVersion();
- if (this->GlobalGenerator->TargetsWindowsPhone()) {
- if (v == "8.0") {
- // Look through the sources for WMAppManifest.xml
- std::vector<cmSourceFile const*> extraSources;
- this->GeneratorTarget->GetExtraSources(extraSources, "");
- bool foundManifest = false;
- for (cmSourceFile const* si : extraSources) {
- // Need to do a lowercase comparison on the filename
- if ("wmappmanifest.xml" ==
- cmSystemTools::LowerCase(si->GetLocation().GetName())) {
- foundManifest = true;
- break;
- }
- }
- if (!foundManifest) {
- this->IsMissingFiles = true;
- }
- } else if (v == "8.1") {
- if (manifestSources.empty()) {
- this->IsMissingFiles = true;
+ std::vector<cmGeneratorTarget::AllConfigSource> manifestSources =
+ this->GeneratorTarget->GetAllConfigSources(
+ cmGeneratorTarget::SourceKindAppManifest);
+ std::string const& v = this->GlobalGenerator->GetSystemVersion();
+ if (this->GlobalGenerator->TargetsWindowsPhone()) {
+ if (v == "8.0") {
+ // Look through the sources for WMAppManifest.xml
+ bool foundManifest = false;
+ for (cmGeneratorTarget::AllConfigSource const& source :
+ this->GeneratorTarget->GetAllConfigSources()) {
+ if (source.Kind == cmGeneratorTarget::SourceKindExtra &&
+ "wmappmanifest.xml" ==
+ cmSystemTools::LowerCase(
+ source.Source->GetLocation().GetName())) {
+ foundManifest = true;
+ break;
}
}
- } else if (this->GlobalGenerator->TargetsWindowsStore()) {
+ if (!foundManifest) {
+ this->IsMissingFiles = true;
+ }
+ } else if (v == "8.1") {
if (manifestSources.empty()) {
- if (v == "8.0") {
- this->IsMissingFiles = true;
- } else if (v == "8.1" || cmHasLiteralPrefix(v, "10.0")) {
- this->IsMissingFiles = true;
- }
+ this->IsMissingFiles = true;
+ }
+ }
+ } else if (this->GlobalGenerator->TargetsWindowsStore()) {
+ if (manifestSources.empty()) {
+ if (v == "8.0") {
+ this->IsMissingFiles = true;
+ } else if (v == "8.1" || cmHasLiteralPrefix(v, "10.0")) {
+ this->IsMissingFiles = true;
}
}
}
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index e3782f4..7c71de3 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -13,10 +13,11 @@
#include <unordered_map>
#include <vector>
+#include "cmGeneratorTarget.h"
+
class cmComputeLinkInformation;
class cmCustomCommand;
class cmGeneratedFileStream;
-class cmGeneratorTarget;
class cmGlobalVisualStudio10Generator;
class cmLocalVisualStudio10Generator;
class cmMakefile;
@@ -238,6 +239,14 @@ private:
using ToolSourceMap = std::map<std::string, ToolSources>;
ToolSourceMap Tools;
+ std::set<std::string> ExpectedResxHeaders;
+ std::set<std::string> ExpectedXamlHeaders;
+ std::set<std::string> ExpectedXamlSources;
+ std::vector<cmSourceFile const*> ResxObjs;
+ std::vector<cmSourceFile const*> XamlObjs;
+ void ClassifyAllConfigSources();
+ void ClassifyAllConfigSource(cmGeneratorTarget::AllConfigSource const& acs);
+
using ConfigToSettings =
std::unordered_map<std::string,
std::unordered_map<std::string, std::string>>;
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index 7775f62..937b4ce 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -151,34 +151,6 @@ bool cmVisualStudioGeneratorOptions::UsingSBCS() const
return false;
}
-void cmVisualStudioGeneratorOptions::FixCudaRuntime(cmGeneratorTarget* target)
-{
- std::map<std::string, FlagValue>::const_iterator i =
- this->FlagMap.find("CudaRuntime");
- if (i == this->FlagMap.end()) {
- // User didn't provide am override so get the property value
- cmProp runtimeLibraryValue = target->GetProperty("CUDA_RUNTIME_LIBRARY");
- if (runtimeLibraryValue) {
- std::string cudaRuntime =
- cmSystemTools::UpperCase(cmGeneratorExpression::Evaluate(
- *runtimeLibraryValue, this->LocalGenerator, this->Configuration,
- target));
- if (cudaRuntime == "STATIC") {
- this->AddFlag("CudaRuntime", "Static");
- }
- if (cudaRuntime == "SHARED") {
- this->AddFlag("CudaRuntime", "Shared");
- }
- if (cudaRuntime == "NONE") {
- this->AddFlag("CudaRuntime", "None");
- }
- } else {
- // nvcc default is static
- this->AddFlag("CudaRuntime", "Static");
- }
- }
-}
-
void cmVisualStudioGeneratorOptions::FixCudaCodeGeneration()
{
// Extract temporary values stored by our flag table.
diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h
index b335694..f9b50a7 100644
--- a/Source/cmVisualStudioGeneratorOptions.h
+++ b/Source/cmVisualStudioGeneratorOptions.h
@@ -63,7 +63,6 @@ public:
bool UsingSBCS() const;
void FixCudaCodeGeneration();
- void FixCudaRuntime(cmGeneratorTarget* target);
void FixManifestUACFlags();
diff --git a/Source/cmWorkerPool.cxx b/Source/cmWorkerPool.cxx
index aa0d6b3..12aba4f 100644
--- a/Source/cmWorkerPool.cxx
+++ b/Source/cmWorkerPool.cxx
@@ -13,7 +13,7 @@
#include <cm/memory>
-#include "cm_uv.h"
+#include <cm3p/uv.h>
#include "cmRange.h"
#include "cmStringAlgorithms.h"
@@ -469,11 +469,9 @@ void cmWorkerPoolWorker::UVProcessStart(uv_async_t* handle)
void cmWorkerPoolWorker::UVProcessFinished()
{
- {
- std::lock_guard<std::mutex> lock(Proc_.Mutex);
- if (Proc_.ROP && (Proc_.ROP->IsFinished() || !Proc_.ROP->IsStarted())) {
- Proc_.ROP.reset();
- }
+ std::lock_guard<std::mutex> lock(Proc_.Mutex);
+ if (Proc_.ROP && (Proc_.ROP->IsFinished() || !Proc_.ROP->IsStarted())) {
+ Proc_.ROP.reset();
}
// Notify idling thread
Proc_.Condition.notify_one();
@@ -532,6 +530,7 @@ public:
unsigned int JobsProcessing = 0;
std::deque<cmWorkerPool::JobHandleT> Queue;
std::condition_variable Condition;
+ std::condition_variable ConditionFence;
std::vector<std::unique_ptr<cmWorkerPoolWorker>> Workers;
// -- References
@@ -593,19 +592,12 @@ bool cmWorkerPoolInternal::Process()
void cmWorkerPoolInternal::Abort()
{
- bool notifyThreads = false;
// Clear all jobs and set abort flag
- {
- std::lock_guard<std::mutex> guard(Mutex);
- if (Processing && !Aborting) {
- // Register abort and clear queue
- Aborting = true;
- Queue.clear();
- notifyThreads = true;
- }
- }
- if (notifyThreads) {
- // Wake threads
+ std::lock_guard<std::mutex> guard(Mutex);
+ if (!Aborting) {
+ // Register abort and clear queue
+ Aborting = true;
+ Queue.clear();
Condition.notify_all();
}
}
@@ -669,7 +661,7 @@ void cmWorkerPoolInternal::Work(unsigned int workerIndex)
if (Aborting) {
break;
}
- // Wait for new jobs
+ // Wait for new jobs on the main CV
if (Queue.empty()) {
++WorkersIdle;
Condition.wait(uLock);
@@ -677,20 +669,34 @@ void cmWorkerPoolInternal::Work(unsigned int workerIndex)
continue;
}
- // Check for fence jobs
- if (FenceProcessing || Queue.front()->IsFence()) {
- if (JobsProcessing != 0) {
- Condition.wait(uLock);
- continue;
- }
- // No jobs get processed. Set the fence job processing flag.
- FenceProcessing = true;
+ // If there is a fence currently active or waiting,
+ // sleep on the main CV and try again.
+ if (FenceProcessing) {
+ Condition.wait(uLock);
+ continue;
}
// Pop next job from queue
jobHandle = std::move(Queue.front());
Queue.pop_front();
+ // Check for fence jobs
+ bool raisedFence = false;
+ if (jobHandle->IsFence()) {
+ FenceProcessing = true;
+ raisedFence = true;
+ // Wait on the Fence CV until all pending jobs are done.
+ while (JobsProcessing != 0 && !Aborting) {
+ ConditionFence.wait(uLock);
+ }
+ // When aborting, explicitly kick all threads alive once more.
+ if (Aborting) {
+ FenceProcessing = false;
+ Condition.notify_all();
+ break;
+ }
+ }
+
// Unlocked scope for job processing
++JobsProcessing;
{
@@ -701,11 +707,18 @@ void cmWorkerPoolInternal::Work(unsigned int workerIndex)
}
--JobsProcessing;
- // Was this a fence job?
- if (FenceProcessing) {
+ // If this was the thread that entered fence processing
+ // originally, notify all idling workers that the fence
+ // is done.
+ if (raisedFence) {
FenceProcessing = false;
Condition.notify_all();
}
+ // If fence processing is still not done, notify the
+ // the fencing worker when all active jobs are done.
+ if (FenceProcessing && JobsProcessing == 0) {
+ ConditionFence.notify_all();
+ }
}
// Decrement running workers count
diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx
index 9ac1457..f4c2f2d 100644
--- a/Source/cmXCodeScheme.cxx
+++ b/Source/cmXCodeScheme.cxx
@@ -396,7 +396,8 @@ void cmXCodeScheme::WriteBuildableReference(cmXMLWriter& xout,
xout.BreakAttributes();
xout.Attribute("BuildableIdentifier", "primary");
xout.Attribute("BlueprintIdentifier", xcObj->GetId());
- xout.Attribute("BuildableName", xcObj->GetTarget()->GetFullName());
+ std::string const noConfig; // FIXME: What config to use here?
+ xout.Attribute("BuildableName", xcObj->GetTarget()->GetFullName(noConfig));
xout.Attribute("BlueprintName", xcObj->GetTarget()->GetName());
xout.Attribute("ReferencedContainer", "container:" + container);
xout.EndElement();
diff --git a/Source/cmXMLParser.cxx b/Source/cmXMLParser.cxx
index ad5c4ba..24da8c6 100644
--- a/Source/cmXMLParser.cxx
+++ b/Source/cmXMLParser.cxx
@@ -7,9 +7,9 @@
#include <iostream>
#include <sstream>
-#include "cmsys/FStream.hxx"
+#include <cm3p/expat.h>
-#include "cm_expat.h"
+#include "cmsys/FStream.hxx"
cmXMLParser::cmXMLParser()
{
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index c95cf4f..65d5f10 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -57,7 +57,7 @@
#if !defined(CMAKE_BOOTSTRAP)
# include <unordered_map>
-# include "cm_jsoncpp_writer.h"
+# include <cm3p/json/writer.h>
# include "cmFileAPI.h"
# include "cmGraphVizWriter.h"
@@ -138,6 +138,7 @@ using JsonValueMapType = std::unordered_map<std::string, Json::Value>;
static bool cmakeCheckStampFile(const std::string& stampName);
static bool cmakeCheckStampList(const std::string& stampList);
+#ifndef CMAKE_BOOTSTRAP
static void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/,
void* ctx, const char* /*unused*/,
const cmMakefile* /*unused*/)
@@ -145,6 +146,7 @@ static void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/,
cmake* cm = reinterpret_cast<cmake*>(ctx);
cm->MarkCliAsUsed(variable);
}
+#endif
cmake::cmake(Role role, cmState::Mode mode)
: FileTimeCache(cm::make_unique<cmFileTimeCache>())
@@ -289,7 +291,8 @@ void cmake::CleanupCommandsAndMacros()
// Parse the args
bool cmake::SetCacheArgs(const std::vector<std::string>& args)
{
- bool findPackageMode = false;
+ auto findPackageMode = false;
+ auto seenScriptOption = false;
for (unsigned int i = 1; i < args.size(); ++i) {
std::string const& arg = args[i];
if (cmHasLiteralPrefix(arg, "-D")) {
@@ -444,6 +447,11 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
this->SetHomeOutputDirectory(
cmSystemTools::GetCurrentWorkingDirectory());
this->ReadListFile(args, path);
+ seenScriptOption = true;
+ } else if (arg == "--" && seenScriptOption) {
+ // Stop processing CMake args and avoid possible errors
+ // when arbitrary args are given to CMake script.
+ break;
} else if (cmHasLiteralPrefix(arg, "--find-package")) {
findPackageMode = true;
}
diff --git a/Source/cmake.h b/Source/cmake.h
index cfcd264..cd152cb 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -27,7 +27,7 @@
#include "cmStateTypes.h"
#if !defined(CMAKE_BOOTSTRAP)
-# include "cm_jsoncpp_value.h"
+# include <cm3p/json/value.h>
#endif
class cmExternalMakefileProjectGeneratorFactory;
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 84d0538..b12990b 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -1,6 +1,8 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
+#include "cmConfigure.h" // IWYU pragma: keep
+
#include <cassert>
#include <cctype>
#include <climits>
@@ -11,6 +13,8 @@
#include <cmext/algorithm>
+#include <cm3p/uv.h>
+
#include "cmDocumentationEntry.h" // IWYU pragma: keep
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
@@ -27,8 +31,6 @@
#endif
#include "cmsys/Encoding.hxx"
-
-#include "cm_uv.h"
#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP)
# include "cmsys/ConsoleBuf.hxx"
#endif
@@ -318,6 +320,7 @@ int do_cmake(int ac, char const* const* av)
return 0;
}
+#ifndef CMAKE_BOOTSTRAP
int extract_job_number(int& index, char const* current, char const* next,
int len_of_flag)
{
@@ -347,6 +350,7 @@ int extract_job_number(int& index, char const* current, char const* next,
}
return jobs;
}
+#endif
int do_build(int ac, char const* const* av)
{
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index a8e07e4..de76d73 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -4,10 +4,9 @@
#include <cmext/algorithm>
+#include <cm3p/uv.h>
#include <fcntl.h>
-#include "cm_uv.h"
-
#include "cmDuration.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
diff --git a/Source/kwsys/CommandLineArguments.cxx b/Source/kwsys/CommandLineArguments.cxx
index a2ed874..e45db36 100644
--- a/Source/kwsys/CommandLineArguments.cxx
+++ b/Source/kwsys/CommandLineArguments.cxx
@@ -20,9 +20,9 @@
#include <sstream>
#include <vector>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#ifdef _MSC_VER
# pragma warning(disable : 4786)
diff --git a/Source/kwsys/Directory.cxx b/Source/kwsys/Directory.cxx
index d640948..be9158e 100644
--- a/Source/kwsys/Directory.cxx
+++ b/Source/kwsys/Directory.cxx
@@ -103,7 +103,7 @@ void Directory::Clear()
namespace KWSYS_NAMESPACE {
-bool Directory::Load(const std::string& name)
+bool Directory::Load(const std::string& name, std::string* errorMessage)
{
this->Clear();
# if (defined(_MSC_VER) && _MSC_VER < 1300) || defined(__BORLANDC__)
@@ -146,7 +146,8 @@ bool Directory::Load(const std::string& name)
return _findclose(srchHandle) != -1;
}
-unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name)
+unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name,
+ std::string* errorMessage)
{
# if (defined(_MSC_VER) && _MSC_VER < 1300) || defined(__BORLANDC__)
// Older Visual C++ and Embarcadero compilers.
@@ -192,6 +193,8 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name)
# include <sys/types.h>
# include <dirent.h>
+# include <errno.h>
+# include <string.h>
// PGI with glibc has trouble with dirent and large file support:
// http://www.pgroup.com/userforum/viewtopic.php?
@@ -209,29 +212,46 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name)
namespace KWSYS_NAMESPACE {
-bool Directory::Load(const std::string& name)
+bool Directory::Load(const std::string& name, std::string* errorMessage)
{
this->Clear();
+ errno = 0;
DIR* dir = opendir(name.c_str());
if (!dir) {
+ if (errorMessage != nullptr) {
+ *errorMessage = std::string(strerror(errno));
+ }
return false;
}
+ errno = 0;
for (kwsys_dirent* d = readdir(dir); d; d = readdir(dir)) {
this->Internal->Files.emplace_back(d->d_name);
}
+ if (errno != 0) {
+ if (errorMessage != nullptr) {
+ *errorMessage = std::string(strerror(errno));
+ }
+ return false;
+ }
+
this->Internal->Path = name;
closedir(dir);
return true;
}
-unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name)
+unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name,
+ std::string* errorMessage)
{
+ errno = 0;
DIR* dir = opendir(name.c_str());
if (!dir) {
+ if (errorMessage != nullptr) {
+ *errorMessage = std::string(strerror(errno));
+ }
return 0;
}
@@ -239,6 +259,13 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name)
for (kwsys_dirent* d = readdir(dir); d; d = readdir(dir)) {
count++;
}
+ if (errno != 0) {
+ if (errorMessage != nullptr) {
+ *errorMessage = std::string(strerror(errno));
+ }
+ return false;
+ }
+
closedir(dir);
return count;
}
diff --git a/Source/kwsys/Directory.hxx.in b/Source/kwsys/Directory.hxx.in
index 9b0f4c3..7bc9db0 100644
--- a/Source/kwsys/Directory.hxx.in
+++ b/Source/kwsys/Directory.hxx.in
@@ -35,7 +35,7 @@ public:
* in that directory. 0 is returned if the directory can not be
* opened, 1 if it is opened.
*/
- bool Load(const std::string&);
+ bool Load(const std::string&, std::string* errorMessage = nullptr);
/**
* Return the number of files in the current directory.
@@ -46,7 +46,8 @@ public:
* Return the number of files in the specified directory.
* A higher performance static method.
*/
- static unsigned long GetNumberOfFilesInDirectory(const std::string&);
+ static unsigned long GetNumberOfFilesInDirectory(
+ const std::string&, std::string* errorMessage = nullptr);
/**
* Return the file at the given index, the indexing is 0 based
diff --git a/Source/kwsys/EncodingCXX.cxx b/Source/kwsys/EncodingCXX.cxx
index 5cad934..c68c73c 100644
--- a/Source/kwsys/EncodingCXX.cxx
+++ b/Source/kwsys/EncodingCXX.cxx
@@ -17,8 +17,8 @@
# include "Encoding.hxx.in"
#endif
-#include <stdlib.h>
-#include <string.h>
+#include <cstdlib>
+#include <cstring>
#include <vector>
#ifdef _MSC_VER
diff --git a/Source/kwsys/Glob.cxx b/Source/kwsys/Glob.cxx
index 8e30f92..5452f73 100644
--- a/Source/kwsys/Glob.cxx
+++ b/Source/kwsys/Glob.cxx
@@ -23,9 +23,9 @@
#include <string>
#include <vector>
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
+#include <cctype>
+#include <cstdio>
+#include <cstring>
namespace KWSYS_NAMESPACE {
#if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__)
// On Windows and Apple, no difference between lower and upper case
@@ -182,7 +182,15 @@ bool Glob::RecurseDirectory(std::string::size_type start,
const std::string& dir, GlobMessages* messages)
{
kwsys::Directory d;
- if (!d.Load(dir)) {
+ std::string errorMessage;
+ if (!d.Load(dir, &errorMessage)) {
+ if (messages) {
+ if (!errorMessage.empty()) {
+ messages->push_back(Message(Glob::warning,
+ "Error listing directory '" + dir +
+ "'! Reason: '" + errorMessage + "'"));
+ }
+ }
return true;
}
unsigned long cc;
@@ -278,7 +286,9 @@ void Glob::ProcessDirectory(std::string::size_type start,
// std::cout << "ProcessDirectory: " << dir << std::endl;
bool last = (start == this->Internals->Expressions.size() - 1);
if (last && this->Recurse) {
- this->RecurseDirectory(start, dir, messages);
+ if (kwsys::SystemTools::FileIsDirectory(dir)) {
+ this->RecurseDirectory(start, dir, messages);
+ }
return;
}
diff --git a/Source/kwsys/Glob.hxx.in b/Source/kwsys/Glob.hxx.in
index 170766f..b5a34d5 100644
--- a/Source/kwsys/Glob.hxx.in
+++ b/Source/kwsys/Glob.hxx.in
@@ -28,6 +28,7 @@ public:
enum MessageType
{
error,
+ warning,
cyclicRecursion
};
diff --git a/Source/kwsys/RegularExpression.cxx b/Source/kwsys/RegularExpression.cxx
index 5e6f8da..4f74eba 100644
--- a/Source/kwsys/RegularExpression.cxx
+++ b/Source/kwsys/RegularExpression.cxx
@@ -28,8 +28,8 @@
# include "RegularExpression.hxx.in"
#endif
-#include <stdio.h>
-#include <string.h>
+#include <cstdio>
+#include <cstring>
namespace KWSYS_NAMESPACE {
@@ -367,8 +367,7 @@ bool RegularExpression::compile(const char* exp)
// Allocate space.
//#ifndef _WIN32
- if (this->program != nullptr)
- delete[] this->program;
+ delete[] this->program;
//#endif
this->program = new char[comp.regsize];
this->progsize = static_cast<int>(comp.regsize);
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index ba9fa67..c565823 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -64,9 +64,9 @@ typedef int siginfo_t;
#else
# include <sys/types.h>
-# include <errno.h> // extern int errno;
+# include <cerrno> // extern int errno;
+# include <csignal>
# include <fcntl.h>
-# include <signal.h>
# include <sys/resource.h> // getrlimit
# include <sys/time.h>
# include <sys/utsname.h> // int uname(struct utsname *buf);
@@ -163,11 +163,11 @@ typedef struct rlimit ResourceLimitType;
# undef KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP
#endif
-#include <ctype.h> // int isdigit(int c);
+#include <cctype> // int isdigit(int c);
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <memory.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#if defined(KWSYS_USE_LONG_LONG)
# if defined(KWSYS_IOS_HAS_OSTREAM_LONG_LONG)
@@ -1366,7 +1366,7 @@ std::string SymbolProperties::GetFileName(const std::string& path) const
{
std::string file(path);
if (!this->ReportPath) {
- size_t at = file.rfind("/");
+ size_t at = file.rfind('/');
if (at != std::string::npos) {
file.erase(0, at + 1);
}
@@ -3387,8 +3387,8 @@ std::string SystemInformationImplementation::ExtractValueFromCpuInfoFile(
size_t pos = buffer.find(word, init);
if (pos != std::string::npos) {
this->CurrentPositionInFile = pos;
- pos = buffer.find(":", pos);
- size_t pos2 = buffer.find("\n", pos);
+ pos = buffer.find(':', pos);
+ size_t pos2 = buffer.find('\n', pos);
if (pos != std::string::npos && pos2 != std::string::npos) {
// It may happen that the beginning matches, but this is still not the
// requested key.
@@ -3937,7 +3937,7 @@ std::string SystemInformationImplementation::GetProgramStack(int firstFrame,
int wholePath)
{
std::ostringstream oss;
- std::string programStack = "";
+ std::string programStack;
#ifdef KWSYS_SYSTEMINFORMATION_HAS_DBGHELP
(void)wholePath;
@@ -4688,7 +4688,7 @@ std::string SystemInformationImplementation::ExtractValueFromSysCtl(
size_t pos = this->SysCtlBuffer.find(word);
if (pos != std::string::npos) {
pos = this->SysCtlBuffer.find(": ", pos);
- size_t pos2 = this->SysCtlBuffer.find("\n", pos);
+ size_t pos2 = this->SysCtlBuffer.find('\n', pos);
if (pos != std::string::npos && pos2 != std::string::npos) {
return this->SysCtlBuffer.substr(pos + 2, pos2 - pos - 2);
}
@@ -5500,13 +5500,13 @@ void SystemInformationImplementation::TrimNewline(std::string& output)
{
// remove \r
std::string::size_type pos = 0;
- while ((pos = output.find("\r", pos)) != std::string::npos) {
+ while ((pos = output.find('\r', pos)) != std::string::npos) {
output.erase(pos);
}
// remove \n
pos = 0;
- while ((pos = output.find("\n", pos)) != std::string::npos) {
+ while ((pos = output.find('\n', pos)) != std::string::npos) {
output.erase(pos);
}
}
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 3a6ceec..a6d210f 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -24,6 +24,7 @@
#include KWSYS_HEADER(Encoding.h)
#include KWSYS_HEADER(Encoding.hxx)
+#include <algorithm>
#include <fstream>
#include <iostream>
#include <set>
@@ -49,15 +50,15 @@
# pragma set woff 1375 /* base class destructor not virtual */
#endif
-#include <ctype.h>
-#include <errno.h>
+#include <cctype>
+#include <cerrno>
#ifdef __QNX__
# include <malloc.h> /* for malloc/free on QNX */
#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
#if defined(_WIN32) && !defined(_MSC_VER) && defined(__GNUC__)
# include <strings.h> /* for strcasecmp */
@@ -69,7 +70,7 @@
// support for realpath call
#ifndef _WIN32
-# include <limits.h>
+# include <climits>
# include <pwd.h>
# include <sys/ioctl.h>
# include <sys/time.h>
@@ -80,7 +81,7 @@
# include <sys/param.h>
# include <termios.h>
# endif
-# include <signal.h> /* sigprocmask */
+# include <csignal> /* sigprocmask */
#endif
#ifdef __linux
@@ -892,8 +893,12 @@ const char* SystemTools::GetExecutableExtension()
FILE* SystemTools::Fopen(const std::string& file, const char* mode)
{
#ifdef _WIN32
+ // Remove any 'e', which is supported on UNIX, but not Windows.
+ std::wstring trimmedMode = Encoding::ToWide(mode);
+ trimmedMode.erase(std::remove(trimmedMode.begin(), trimmedMode.end(), L'e'),
+ trimmedMode.end());
return _wfopen(Encoding::ToWindowsExtendedPath(file).c_str(),
- Encoding::ToWide(mode).c_str());
+ trimmedMode.c_str());
#else
return fopen(file.c_str(), mode);
#endif
@@ -2113,7 +2118,7 @@ std::string SystemTools::ConvertToUnixOutputPath(const std::string& path)
ret.erase(pos, 1);
}
// escape spaces and () in the path
- if (ret.find_first_of(" ") != std::string::npos) {
+ if (ret.find_first_of(' ') != std::string::npos) {
std::string result;
char lastch = 1;
for (const char* ch = ret.c_str(); *ch != '\0'; ++ch) {
@@ -2511,8 +2516,8 @@ bool SystemTools::CopyADirectory(const std::string& source,
return false;
}
for (fileNum = 0; fileNum < dir.GetNumberOfFiles(); ++fileNum) {
- if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)), ".") &&
- strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)), "..")) {
+ if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)), ".") != 0 &&
+ strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)), "..") != 0) {
std::string fullPath = source;
fullPath += "/";
fullPath += dir.GetFile(static_cast<unsigned long>(fileNum));
@@ -2674,8 +2679,8 @@ bool SystemTools::RemoveADirectory(const std::string& source)
dir.Load(source);
size_t fileNum;
for (fileNum = 0; fileNum < dir.GetNumberOfFiles(); ++fileNum) {
- if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)), ".") &&
- strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)), "..")) {
+ if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)), ".") != 0 &&
+ strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)), "..") != 0) {
std::string fullPath = source;
fullPath += "/";
fullPath += dir.GetFile(static_cast<unsigned long>(fileNum));
@@ -3153,7 +3158,7 @@ bool SystemTools::SplitProgramPath(const std::string& in_name,
SystemTools::ConvertToUnixSlashes(dir);
if (!SystemTools::FileIsDirectory(dir)) {
- std::string::size_type slashPos = dir.rfind("/");
+ std::string::size_type slashPos = dir.rfind('/');
if (slashPos != std::string::npos) {
file = dir.substr(slashPos + 1);
dir.resize(slashPos);
@@ -3711,7 +3716,7 @@ std::string SystemTools::GetFilenamePath(const std::string& filename)
std::string fn = filename;
SystemTools::ConvertToUnixSlashes(fn);
- std::string::size_type slash_pos = fn.rfind("/");
+ std::string::size_type slash_pos = fn.rfind('/');
if (slash_pos == 0) {
return "/";
}
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index cd7b728..ae08e57 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -549,7 +549,8 @@ public:
*/
/**
- * Open a file considering unicode.
+ * Open a file considering unicode. On Windows, if 'e' is present in
+ * mode it is first discarded.
*/
static FILE* Fopen(const std::string& file, const char* mode);
diff --git a/Source/kwsys/testCommandLineArguments.cxx b/Source/kwsys/testCommandLineArguments.cxx
index 79ebe1a..0786751 100644
--- a/Source/kwsys/testCommandLineArguments.cxx
+++ b/Source/kwsys/testCommandLineArguments.cxx
@@ -12,8 +12,8 @@
#include <iostream>
#include <vector>
-#include <stddef.h> /* size_t */
-#include <string.h> /* strcmp */
+#include <cstddef> /* size_t */
+#include <cstring> /* strcmp */
static void* random_ptr = reinterpret_cast<void*>(0x123);
diff --git a/Source/kwsys/testCommandLineArguments1.cxx b/Source/kwsys/testCommandLineArguments1.cxx
index cbc3002..2f6b735 100644
--- a/Source/kwsys/testCommandLineArguments1.cxx
+++ b/Source/kwsys/testCommandLineArguments1.cxx
@@ -12,8 +12,8 @@
#include <iostream>
#include <vector>
-#include <assert.h> /* assert */
-#include <string.h> /* strcmp */
+#include <cassert> /* assert */
+#include <cstring> /* strcmp */
int testCommandLineArguments1(int argc, char* argv[])
{
@@ -51,9 +51,7 @@ int testCommandLineArguments1(int argc, char* argv[])
std::cout << "Value of N: " << n << std::endl;
std::cout << "Value of M: " << m << std::endl;
std::cout << "Value of P: " << p << std::endl;
- if (m) {
- delete[] m;
- }
+ delete[] m;
char** newArgv = nullptr;
int newArgc = 0;
diff --git a/Source/kwsys/testDirectory.cxx b/Source/kwsys/testDirectory.cxx
index b1ab0c8..eb3ca32 100644
--- a/Source/kwsys/testDirectory.cxx
+++ b/Source/kwsys/testDirectory.cxx
@@ -57,7 +57,11 @@ int _doLongPathTest()
Directory testdir;
// Set res to failure if the directory doesn't load
- res += !testdir.Load(testdirpath);
+ std::string errorMessage = "";
+ res += !testdir.Load(testdirpath, &errorMessage);
+ if (errorMessage != "") {
+ std::cerr << "Failed to list directory: " << errorMessage << std::endl;
+ }
// Increment res failure if the directory appears empty
res += testdir.GetNumberOfFiles() == 0;
// Increment res failures if the path has changed from
@@ -73,6 +77,34 @@ int _doLongPathTest()
return res;
}
+int _nonExistentDirectoryTest()
+{
+ using namespace kwsys;
+ int res = 0;
+ std::string testdirpath(TEST_SYSTEMTOOLS_BINARY_DIR
+ "/directory_testing/doesnt_exist/");
+ std::string errorMessage;
+ Directory testdir;
+
+ errorMessage = "foo";
+ // Increment res failure if directory lists
+ res += testdir.Load(testdirpath, &errorMessage);
+#if !defined(_WIN32) || defined(__CYGWIN__)
+ // Increment res failure if errorMessage is unmodified
+ res += (errorMessage == "foo");
+#endif
+
+ errorMessage = "foo";
+ // Increment res failure if directory has files
+ res += (testdir.GetNumberOfFilesInDirectory(testdirpath, &errorMessage) > 0);
+#if !defined(_WIN32) || defined(__CYGWIN__)
+ // Increment res failure if errorMessage is unmodified
+ res += (errorMessage == "foo");
+#endif
+
+ return res;
+}
+
int _copyDirectoryTest()
{
using namespace kwsys;
@@ -106,5 +138,6 @@ int _copyDirectoryTest()
int testDirectory(int, char* [])
{
- return _doLongPathTest() + _copyDirectoryTest();
+ return _doLongPathTest() + _nonExistentDirectoryTest() +
+ _copyDirectoryTest();
}
diff --git a/Source/kwsys/testDynload.c b/Source/kwsys/testDynload.c
index c49f747..33a431e 100644
--- a/Source/kwsys/testDynload.c
+++ b/Source/kwsys/testDynload.c
@@ -8,6 +8,6 @@
DL_EXPORT int TestDynamicLoaderData = 0;
-DL_EXPORT void TestDynamicLoaderSymbolPointer()
+DL_EXPORT void TestDynamicLoaderSymbolPointer(void)
{
}
diff --git a/Source/kwsys/testEncoding.cxx b/Source/kwsys/testEncoding.cxx
index d672aed..ee93e8d 100644
--- a/Source/kwsys/testEncoding.cxx
+++ b/Source/kwsys/testEncoding.cxx
@@ -10,10 +10,10 @@
#include KWSYS_HEADER(Encoding.h)
#include <algorithm>
+#include <clocale>
+#include <cstdlib>
+#include <cstring>
#include <iostream>
-#include <locale.h>
-#include <stdlib.h>
-#include <string.h>
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
@@ -59,7 +59,7 @@ static int testHelloWorldEncoding()
std::string str2 = kwsys::Encoding::ToNarrow(wstr);
wchar_t* c_wstr = kwsysEncoding_DupToWide(str.c_str());
char* c_str2 = kwsysEncoding_DupToNarrow(c_wstr);
- if (!wstr.empty() && (str != str2 || strcmp(c_str2, str.c_str()))) {
+ if (!wstr.empty() && (str != str2 || strcmp(c_str2, str.c_str()) != 0)) {
std::cout << "converted string was different: " << str2 << std::endl;
std::cout << "converted string was different: " << c_str2 << std::endl;
ret++;
diff --git a/Source/kwsys/testFStream.cxx b/Source/kwsys/testFStream.cxx
index 5009e98..5762378 100644
--- a/Source/kwsys/testFStream.cxx
+++ b/Source/kwsys/testFStream.cxx
@@ -7,7 +7,7 @@
#endif
#include KWSYS_HEADER(FStream.hxx)
-#include <string.h>
+#include <cstring>
#ifdef __BORLANDC__
# include <mem.h> /* memcmp */
#endif
diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx
index 8909b49..ff8e2b2 100644
--- a/Source/kwsys/testSystemTools.cxx
+++ b/Source/kwsys/testSystemTools.cxx
@@ -20,10 +20,10 @@
// left on disk.
#include <testSystemTools.h>
+#include <cstdlib> /* free */
+#include <cstring> /* strcmp */
#include <iostream>
#include <sstream>
-#include <stdlib.h> /* free */
-#include <string.h> /* strcmp */
#if defined(_WIN32) && !defined(__CYGWIN__)
# include <io.h> /* _umask (MSVC) / umask (Borland) */
# ifdef _MSC_VER
@@ -507,7 +507,7 @@ static bool CheckStringOperations()
char* cres =
kwsys::SystemTools::AppendStrings("Mary Had A", " Little Lamb.");
- if (strcmp(cres, "Mary Had A Little Lamb.")) {
+ if (strcmp(cres, "Mary Had A Little Lamb.") != 0) {
std::cerr << "Problem with AppendStrings "
<< "\"Mary Had A\" \" Little Lamb.\"" << std::endl;
res = false;
@@ -515,7 +515,7 @@ static bool CheckStringOperations()
delete[] cres;
cres = kwsys::SystemTools::AppendStrings("Mary Had", " A ", "Little Lamb.");
- if (strcmp(cres, "Mary Had A Little Lamb.")) {
+ if (strcmp(cres, "Mary Had A Little Lamb.") != 0) {
std::cerr << "Problem with AppendStrings "
<< "\"Mary Had\" \" A \" \"Little Lamb.\"" << std::endl;
res = false;
@@ -529,7 +529,7 @@ static bool CheckStringOperations()
}
cres = kwsys::SystemTools::RemoveChars("Mary Had A Little Lamb.", "aeiou");
- if (strcmp(cres, "Mry Hd A Lttl Lmb.")) {
+ if (strcmp(cres, "Mry Hd A Lttl Lmb.") != 0) {
std::cerr << "Problem with RemoveChars "
<< "\"Mary Had A Little Lamb.\"" << std::endl;
res = false;
@@ -537,7 +537,7 @@ static bool CheckStringOperations()
delete[] cres;
cres = kwsys::SystemTools::RemoveCharsButUpperHex("Mary Had A Little Lamb.");
- if (strcmp(cres, "A")) {
+ if (strcmp(cres, "A") != 0) {
std::cerr << "Problem with RemoveCharsButUpperHex "
<< "\"Mary Had A Little Lamb.\"" << std::endl;
res = false;
@@ -546,7 +546,7 @@ static bool CheckStringOperations()
char* cres2 = strdup("Mary Had A Little Lamb.");
kwsys::SystemTools::ReplaceChars(cres2, "aeiou", 'X');
- if (strcmp(cres2, "MXry HXd A LXttlX LXmb.")) {
+ if (strcmp(cres2, "MXry HXd A LXttlX LXmb.") != 0) {
std::cerr << "Problem with ReplaceChars "
<< "\"Mary Had A Little Lamb.\"" << std::endl;
res = false;
@@ -568,7 +568,7 @@ static bool CheckStringOperations()
}
cres = kwsys::SystemTools::DuplicateString("Mary Had A Little Lamb.");
- if (strcmp(cres, "Mary Had A Little Lamb.")) {
+ if (strcmp(cres, "Mary Had A Little Lamb.") != 0) {
std::cerr << "Problem with DuplicateString "
<< "\"Mary Had A Little Lamb.\"" << std::endl;
res = false;
diff --git a/Tests/CMakeLib/testUVProcessChain.cxx b/Tests/CMakeLib/testUVProcessChain.cxx
index 71a1764..61a77cf 100644
--- a/Tests/CMakeLib/testUVProcessChain.cxx
+++ b/Tests/CMakeLib/testUVProcessChain.cxx
@@ -8,7 +8,7 @@
#include <cm/memory>
-#include "cm_uv.h"
+#include <cm3p/uv.h>
#include "cmGetPipes.h"
#include "cmUVHandlePtr.h"
diff --git a/Tests/CMakeLib/testUVRAII.cxx b/Tests/CMakeLib/testUVRAII.cxx
index cb05ace..0607f44 100644
--- a/Tests/CMakeLib/testUVRAII.cxx
+++ b/Tests/CMakeLib/testUVRAII.cxx
@@ -3,7 +3,7 @@
#include <thread>
#include <utility>
-#include "cm_uv.h"
+#include <cm3p/uv.h>
#include "cmUVHandlePtr.h"
diff --git a/Tests/CMakeLib/testUVStreambuf.cxx b/Tests/CMakeLib/testUVStreambuf.cxx
index cd9c9d4..b86ed76 100644
--- a/Tests/CMakeLib/testUVStreambuf.cxx
+++ b/Tests/CMakeLib/testUVStreambuf.cxx
@@ -3,10 +3,9 @@
#include <string>
#include <vector>
+#include <cm3p/uv.h>
#include <stdint.h>
-#include "cm_uv.h"
-
#include "cmGetPipes.h"
#include "cmUVHandlePtr.h"
#include "cmUVStreambuf.h"
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 3e16ab6..0c8a639 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -790,13 +790,8 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH
endif()
endmacro()
if(CMake_BUILD_NIGHTLY_RELEASES)
- ADD_NIGHTLY_BUILD_TEST(CMakeNightlyWin32
- win32_release.cmake)
- ADD_NIGHTLY_BUILD_TEST(CMakeNightlyWin64
- win64_release.cmake)
ADD_NIGHTLY_BUILD_TEST(CMakeNightlyOSX
osx_release.cmake)
- set_property(TEST CMakeNightlyWin64 PROPERTY DEPENDS CMakeNightlyWin32)
endif()
# add tests with more complex invocations
@@ -1477,7 +1472,7 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH
endif()
if(CMake_TEST_FindPython OR CMake_TEST_FindPython_NumPy
- OR CMake_TEST_FindPython_Conda OR CMake_TEST_FindPython_IronPython)
+ OR CMake_TEST_FindPython_Conda OR CMake_TEST_FindPython_IronPython OR CMake_TEST_FindPython_PyPy)
add_subdirectory(FindPython)
endif()
diff --git a/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt b/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt
index 90aa921..1570c37 100644
--- a/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt
+++ b/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt
@@ -18,16 +18,16 @@ if(APPLE)
list(APPEND LANGUAGES OBJC OBJCXX)
endif()
-foreach(lang ${LANGUAGES})
- check_language(${lang})
- if(NOT DEFINED CMAKE_${lang}_COMPILER)
- message(FATAL_ERROR "check_language(${lang}) did not set result")
+foreach(test_lang ${LANGUAGES})
+ check_language(${test_lang})
+ if(NOT DEFINED CMAKE_${test_lang}_COMPILER)
+ message(FATAL_ERROR "check_language(${test_lang}) did not set result")
endif()
- if(DEFINED expect_${lang})
- if(expect_${lang} AND NOT CMAKE_${lang}_COMPILER)
- message(FATAL_ERROR "check_language(${lang}) should not fail!")
- elseif(NOT expect_${lang} AND CMAKE_${lang}_COMPILER)
- message(FATAL_ERROR "check_language(${lang}) should not succeed!")
+ if(DEFINED expect_${test_lang})
+ if(expect_${test_lang} AND NOT CMAKE_${test_lang}_COMPILER)
+ message(FATAL_ERROR "check_language(${test_lang}) should not fail!")
+ elseif(NOT expect_${test_lang} AND CMAKE_${test_lang}_COMPILER)
+ message(FATAL_ERROR "check_language(${test_lang}) should not succeed!")
endif()
endif()
endforeach()
diff --git a/Tests/CPackWiXGenerator/myotherapp.cpp b/Tests/CPackWiXGenerator/myotherapp.cpp
index 0eefc1c..5047a34 100644
--- a/Tests/CPackWiXGenerator/myotherapp.cpp
+++ b/Tests/CPackWiXGenerator/myotherapp.cpp
@@ -1,3 +1,3 @@
int main()
{
-} \ No newline at end of file
+}
diff --git a/Tests/ConfigSources/CMakeLists.txt b/Tests/ConfigSources/CMakeLists.txt
index f5dd276..6e69e8b 100644
--- a/Tests/ConfigSources/CMakeLists.txt
+++ b/Tests/ConfigSources/CMakeLists.txt
@@ -1,6 +1,17 @@
cmake_minimum_required(VERSION 3.0)
+get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+if(NOT _isMultiConfig AND NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build")
+endif()
project(ConfigSources CXX)
+# Source file(s) named with the configuration(s).
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/config_$<CONFIG>.cpp"
+ CONTENT "void config_$<CONFIG>() {}\n"
+ )
+
+# Per-config sources via INTERFACE_SOURCES.
add_library(iface INTERFACE)
target_sources(iface INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/iface_src.cpp"
@@ -12,10 +23,56 @@ target_compile_definitions(iface INTERFACE
"$<$<CONFIG:Debug>:CFG_DEBUG>"
"$<$<NOT:$<CONFIG:Debug>>:CFG_OTHER>"
)
-
add_executable(ConfigSources
$<$<CONFIG:Debug>:main_debug.cpp>
$<$<NOT:$<CONFIG:Debug>>:main_other.cpp>
$<$<CONFIG:NotAConfig>:does_not_exist.cpp>
+ ${CMAKE_CURRENT_BINARY_DIR}/config_$<CONFIG>.cpp
)
target_link_libraries(ConfigSources iface)
+
+# Per-config sources via LINK_LIBRARIES.
+add_library(iface_debug INTERFACE)
+target_sources(iface_debug INTERFACE
+ "${CMAKE_CURRENT_SOURCE_DIR}/iface_src.cpp"
+ "${CMAKE_CURRENT_SOURCE_DIR}/iface_debug_src.cpp"
+ )
+add_library(iface_other INTERFACE)
+target_sources(iface_other INTERFACE
+ "${CMAKE_CURRENT_SOURCE_DIR}/iface_src.cpp"
+ "${CMAKE_CURRENT_SOURCE_DIR}/iface_other_src.cpp"
+ )
+add_executable(ConfigSourcesLink main.cpp)
+target_compile_definitions(ConfigSourcesLink PRIVATE
+ "$<$<CONFIG:Debug>:CFG_DEBUG>"
+ "$<$<NOT:$<CONFIG:Debug>>:CFG_OTHER>"
+ )
+target_link_libraries(ConfigSourcesLink PRIVATE
+ "$<$<CONFIG:Debug>:iface_debug>"
+ "$<$<NOT:$<CONFIG:Debug>>:iface_other>"
+ "$<$<CONFIG:NotAConfig>:iface_does_not_exist>"
+ )
+
+# Per-config sources via INTERFACE_LINK_LIBRARIES.
+add_library(ConfigSourcesIface INTERFACE)
+target_link_libraries(ConfigSourcesIface INTERFACE
+ "$<$<CONFIG:Debug>:iface_debug>"
+ "$<$<NOT:$<CONFIG:Debug>>:iface_other>"
+ "$<$<CONFIG:NotAConfig>:iface_does_not_exist>"
+ )
+add_executable(ConfigSourcesLinkIface main.cpp)
+target_compile_definitions(ConfigSourcesLinkIface PRIVATE
+ "$<$<CONFIG:Debug>:CFG_DEBUG>"
+ "$<$<NOT:$<CONFIG:Debug>>:CFG_OTHER>"
+ )
+target_link_libraries(ConfigSourcesLinkIface ConfigSourcesIface)
+
+# A target with sources in only one configuration that is not the
+# first in CMAKE_CONFIGURATION_TYPES.
+if(CMAKE_CONFIGURATION_TYPES MATCHES ";([^;]+)")
+ set(one_config "${CMAKE_MATCH_1}")
+else()
+ set(one_config "${CMAKE_BUILD_TYPE}")
+endif()
+add_library(OneConfigOnly OBJECT "$<$<CONFIG:${one_config}>:${CMAKE_CURRENT_SOURCE_DIR}/iface_src.cpp>")
+set_property(TARGET OneConfigOnly PROPERTY LINKER_LANGUAGE CXX)
diff --git a/Tests/ConfigSources/main.cpp b/Tests/ConfigSources/main.cpp
new file mode 100644
index 0000000..c1cd3b2
--- /dev/null
+++ b/Tests/ConfigSources/main.cpp
@@ -0,0 +1,9 @@
+#if !defined(CFG_DEBUG) && !defined(CFG_OTHER)
+# error "Neither CFG_DEBUG or CFG_OTHER is defined."
+#endif
+#ifdef CFG_DEBUG
+# include "main_debug.cpp"
+#endif
+#ifdef CFG_OTHER
+# include "main_other.cpp"
+#endif
diff --git a/Tests/Cuda/CMakeLists.txt b/Tests/Cuda/CMakeLists.txt
index 58b9b03..630cea2 100644
--- a/Tests/Cuda/CMakeLists.txt
+++ b/Tests/Cuda/CMakeLists.txt
@@ -1,5 +1,4 @@
-ADD_TEST_MACRO(Cuda.Complex CudaComplex)
ADD_TEST_MACRO(Cuda.ConsumeCompileFeatures CudaConsumeCompileFeatures)
ADD_TEST_MACRO(Cuda.CXXStandardSetTwice CXXStandardSetTwice)
ADD_TEST_MACRO(Cuda.ObjectLibrary CudaObjectLibrary)
@@ -12,10 +11,16 @@ ADD_TEST_MACRO(Cuda.NotEnabled CudaNotEnabled)
ADD_TEST_MACRO(Cuda.SeparableCompCXXOnly SeparableCompCXXOnly)
ADD_TEST_MACRO(Cuda.Toolkit Toolkit)
ADD_TEST_MACRO(Cuda.IncludePathNoToolkit IncludePathNoToolkit)
-ADD_TEST_MACRO(Cuda.ProperDeviceLibraries ProperDeviceLibraries)
-ADD_TEST_MACRO(Cuda.ProperLinkFlags ProperLinkFlags)
ADD_TEST_MACRO(Cuda.SharedRuntimePlusToolkit SharedRuntimePlusToolkit)
+# Separable compilation is currently only supported on NVCC. Disable tests
+# using it for other compilers.
+if(CMake_TEST_CUDA AND NOT CMake_TEST_CUDA STREQUAL "Clang")
+ ADD_TEST_MACRO(Cuda.Complex CudaComplex)
+ ADD_TEST_MACRO(Cuda.ProperDeviceLibraries ProperDeviceLibraries)
+ ADD_TEST_MACRO(Cuda.ProperLinkFlags ProperLinkFlags)
+endif()
+
# The CUDA only ships the shared version of the toolkit libraries
# on windows
if(NOT WIN32)
diff --git a/Tests/Cuda/ProperLinkFlags/CMakeLists.txt b/Tests/Cuda/ProperLinkFlags/CMakeLists.txt
index b6e0e39..d38da6d 100644
--- a/Tests/Cuda/ProperLinkFlags/CMakeLists.txt
+++ b/Tests/Cuda/ProperLinkFlags/CMakeLists.txt
@@ -9,11 +9,17 @@ project (ProperLinkFlags CUDA CXX)
#Specify a set of valid CUDA flags and an invalid set of CXX flags ( for CUDA )
#to make sure we don't use the CXX flags when linking CUDA executables
-string(APPEND CMAKE_CUDA_FLAGS " -arch=sm_35 --use_fast_math")
+if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
+ string(APPEND CMAKE_CUDA_FLAGS "--use_fast_math")
+elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
+ string(APPEND CMAKE_CUDA_FLAGS "-ffast-math")
+endif()
+
set(CMAKE_CXX_FLAGS "-Wall")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CUDA_STANDARD 11)
+set(CMAKE_CUDA_ARCHITECTURES 35)
add_executable(ProperLinkFlags file1.cu main.cxx)
set_target_properties( ProperLinkFlags
diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt
index d74e810..8244b91 100644
--- a/Tests/CudaOnly/CMakeLists.txt
+++ b/Tests/CudaOnly/CMakeLists.txt
@@ -1,17 +1,37 @@
ADD_TEST_MACRO(CudaOnly.Architecture Architecture)
-ADD_TEST_MACRO(CudaOnly.CircularLinkLine CudaOnlyCircularLinkLine)
ADD_TEST_MACRO(CudaOnly.CompileFlags CudaOnlyCompileFlags)
ADD_TEST_MACRO(CudaOnly.EnableStandard CudaOnlyEnableStandard)
ADD_TEST_MACRO(CudaOnly.ExportPTX CudaOnlyExportPTX)
-ADD_TEST_MACRO(CudaOnly.GPUDebugFlag CudaOnlyGPUDebugFlag)
-ADD_TEST_MACRO(CudaOnly.ResolveDeviceSymbols CudaOnlyResolveDeviceSymbols)
-ADD_TEST_MACRO(CudaOnly.SeparateCompilation CudaOnlySeparateCompilation)
ADD_TEST_MACRO(CudaOnly.SharedRuntimePlusToolkit CudaOnlySharedRuntimePlusToolkit)
ADD_TEST_MACRO(CudaOnly.Standard98 CudaOnlyStandard98)
ADD_TEST_MACRO(CudaOnly.Toolkit CudaOnlyToolkit)
ADD_TEST_MACRO(CudaOnly.WithDefs CudaOnlyWithDefs)
+if(CMake_TEST_CUDA AND NOT CMake_TEST_CUDA STREQUAL "Clang")
+ ADD_TEST_MACRO(CudaOnly.SharedRuntimeViaCUDAFlags CudaOnlySharedRuntimeViaCUDAFlags)
+
+ # Separable compilation is currently only supported on NVCC. Disable tests
+ # using it for other compilers.
+ ADD_TEST_MACRO(CudaOnly.CircularLinkLine CudaOnlyCircularLinkLine)
+ ADD_TEST_MACRO(CudaOnly.ResolveDeviceSymbols CudaOnlyResolveDeviceSymbols)
+ ADD_TEST_MACRO(CudaOnly.SeparateCompilation CudaOnlySeparateCompilation)
+
+ add_test(NAME CudaOnly.DontResolveDeviceSymbols COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMAKE_CURRENT_SOURCE_DIR}/DontResolveDeviceSymbols/"
+ "${CMAKE_CURRENT_BINARY_DIR}/DontResolveDeviceSymbols/"
+ ${build_generator_args}
+ --build-project DontResolveDeviceSymbols
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+
+ # Only NVCC defines __CUDACC_DEBUG__ when compiling in debug mode.
+ ADD_TEST_MACRO(CudaOnly.GPUDebugFlag CudaOnlyGPUDebugFlag)
+endif()
+
# The CUDA only ships the shared version of the toolkit libraries
# on windows
if(NOT WIN32)
@@ -22,17 +42,6 @@ if(MSVC)
ADD_TEST_MACRO(CudaOnly.PDB CudaOnlyPDB)
endif()
-add_test(NAME CudaOnly.DontResolveDeviceSymbols COMMAND
- ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
- --build-and-test
- "${CMAKE_CURRENT_SOURCE_DIR}/DontResolveDeviceSymbols/"
- "${CMAKE_CURRENT_BINARY_DIR}/DontResolveDeviceSymbols/"
- ${build_generator_args}
- --build-project DontResolveDeviceSymbols
- --build-options ${build_options}
- --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
- )
-
add_test(NAME CudaOnly.RuntimeControls COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
diff --git a/Tests/CudaOnly/CompileFlags/CMakeLists.txt b/Tests/CudaOnly/CompileFlags/CMakeLists.txt
index cbce7d6..5e8a8e4 100644
--- a/Tests/CudaOnly/CompileFlags/CMakeLists.txt
+++ b/Tests/CudaOnly/CompileFlags/CMakeLists.txt
@@ -1,16 +1,15 @@
cmake_minimum_required(VERSION 3.17)
-cmake_policy(SET CMP0104 OLD)
project(CompileFlags CUDA)
-# Clear defaults.
-set(CMAKE_CUDA_ARCHITECTURES)
-
add_executable(CudaOnlyCompileFlags main.cu)
# Try passing CUDA architecture flags explicitly.
if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
target_compile_options(CudaOnlyCompileFlags PRIVATE
-gencode arch=compute_50,code=compute_50
- --compiler-options=-DHOST_DEFINE
)
+else()
+ set_property(TARGET CudaOnlyCompileFlags PROPERTY CUDA_ARCHITECTURES 50-real)
endif()
+
+target_compile_options(CudaOnlyCompileFlags PRIVATE -DALWAYS_DEFINE)
diff --git a/Tests/CudaOnly/CompileFlags/main.cu b/Tests/CudaOnly/CompileFlags/main.cu
index 573d230..999c056 100644
--- a/Tests/CudaOnly/CompileFlags/main.cu
+++ b/Tests/CudaOnly/CompileFlags/main.cu
@@ -4,11 +4,8 @@
# endif
#endif
-// Check HOST_DEFINE only for nvcc
-#ifndef __CUDA__
-# ifndef HOST_DEFINE
-# error "HOST_DEFINE not defined!"
-# endif
+#ifndef ALWAYS_DEFINE
+# error "ALWAYS_DEFINE not defined!"
#endif
int main()
diff --git a/Tests/CudaOnly/ExportPTX/CMakeLists.txt b/Tests/CudaOnly/ExportPTX/CMakeLists.txt
index ff6e77c..ee5f54d 100644
--- a/Tests/CudaOnly/ExportPTX/CMakeLists.txt
+++ b/Tests/CudaOnly/ExportPTX/CMakeLists.txt
@@ -34,16 +34,15 @@ static std::string ptx_paths = "$<TARGET_OBJECTS:CudaPTX>";
# need to also pass the --name option
set(output_file ${CMAKE_CURRENT_BINARY_DIR}/embedded_objs.h)
-get_filename_component(cuda_compiler_bin "${CMAKE_CUDA_COMPILER}" DIRECTORY)
+find_package(CUDAToolkit REQUIRED)
find_program(bin_to_c
NAMES bin2c
- PATHS ${cuda_compiler_bin}
+ PATHS ${CUDAToolkit_BIN_DIR}
)
if(NOT bin_to_c)
message(FATAL_ERROR
"bin2c not found:\n"
- " CMAKE_CUDA_COMPILER='${CMAKE_CUDA_COMPILER}'\n"
- " cuda_compiler_bin='${cuda_compiler_bin}'\n"
+ " CUDAToolkit_BIN_DIR='${CUDAToolkit_BIN_DIR}'\n"
)
endif()
diff --git a/Tests/CudaOnly/GPUDebugFlag/CMakeLists.txt b/Tests/CudaOnly/GPUDebugFlag/CMakeLists.txt
index fbef15f..6675655 100644
--- a/Tests/CudaOnly/GPUDebugFlag/CMakeLists.txt
+++ b/Tests/CudaOnly/GPUDebugFlag/CMakeLists.txt
@@ -2,18 +2,19 @@
cmake_minimum_required(VERSION 3.7)
project (GPUDebugFlag CUDA)
-#Goal for this example:
-#verify that -G enables gpu debug flags
-string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_30,code=compute_30")
-string(APPEND CMAKE_CUDA_FLAGS " -G")
set(CMAKE_CUDA_STANDARD 11)
+set(CMAKE_CUDA_ARCHITECTURES 30)
+
+# Goal for this example:
+# Verify that enabling device debug works.
+string(APPEND CMAKE_CUDA_FLAGS " -G")
add_executable(CudaOnlyGPUDebugFlag main.cu)
+#CUDA's __CUDACC_DEBUG__ define was added in NVCC 9.0
+#so if we are below 9.0.0 we will manually add the define so that the test
+#passes
if(CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 9.0.0)
- #CUDA's __CUDACC_DEBUG__ define was added in 9.0
- #so if we are below 9.0.0 we will manually add the define so that the test
- #passes
target_compile_definitions(CudaOnlyGPUDebugFlag PRIVATE "__CUDACC_DEBUG__")
endif()
diff --git a/Tests/CudaOnly/SharedRuntimeViaCUDAFlags/CMakeLists.txt b/Tests/CudaOnly/SharedRuntimeViaCUDAFlags/CMakeLists.txt
new file mode 100644
index 0000000..24ff478
--- /dev/null
+++ b/Tests/CudaOnly/SharedRuntimeViaCUDAFlags/CMakeLists.txt
@@ -0,0 +1,15 @@
+cmake_minimum_required(VERSION 3.17)
+project(SharedRuntimeViaCUDAFlags NONE)
+
+set(CMAKE_CUDA_FLAGS "")
+string(APPEND CMAKE_CUDA_FLAGS "-cudart shared")
+
+enable_language(CUDA)
+
+add_executable(CudaOnlySharedRuntimeViaCUDAFlags main.cu)
+
+if(UNIX)
+ # Help the shared cuda runtime find libcudart as it is not located
+ # in a default system searched location
+ set_property(TARGET CudaOnlySharedRuntimeViaCUDAFlags PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
+endif()
diff --git a/Tests/CudaOnly/SharedRuntimeViaCUDAFlags/main.cu b/Tests/CudaOnly/SharedRuntimeViaCUDAFlags/main.cu
new file mode 100644
index 0000000..766b775
--- /dev/null
+++ b/Tests/CudaOnly/SharedRuntimeViaCUDAFlags/main.cu
@@ -0,0 +1,5 @@
+
+int main()
+{
+ return 0;
+}
diff --git a/Tests/CudaOnly/WithDefs/CMakeLists.txt b/Tests/CudaOnly/WithDefs/CMakeLists.txt
index add8131..0ed81d8 100644
--- a/Tests/CudaOnly/WithDefs/CMakeLists.txt
+++ b/Tests/CudaOnly/WithDefs/CMakeLists.txt
@@ -18,7 +18,7 @@ target_compile_options(CudaOnlyWithDefs
PRIVATE
-DFLAG_COMPILE_LANG_$<COMPILE_LANGUAGE>
-DFLAG_LANG_IS_CUDA=$<COMPILE_LANGUAGE:CUDA>
- --compiler-options=-DHOST_DEFINE
+ $<$<CUDA_COMPILER_ID:NVIDIA>:--compiler-options=-DHOST_DEFINE> # Host-only defines are possible only on NVCC.
)
target_compile_definitions(CudaOnlyWithDefs
diff --git a/Tests/CudaOnly/WithDefs/main.notcu b/Tests/CudaOnly/WithDefs/main.notcu
index a5f4ed6..9119eba 100644
--- a/Tests/CudaOnly/WithDefs/main.notcu
+++ b/Tests/CudaOnly/WithDefs/main.notcu
@@ -7,8 +7,10 @@
# error "INC_CUDA not defined!"
#endif
-#ifndef HOST_DEFINE
-# error "HOST_DEFINE not defined!"
+#ifdef __NVCC__
+# ifndef HOST_DEFINE
+# error "HOST_DEFINE not defined!"
+# endif
#endif
#ifndef PACKED_DEFINE
diff --git a/Tests/FindDoxygen/SimpleTest/CMakeLists.txt b/Tests/FindDoxygen/SimpleTest/CMakeLists.txt
index 332cecc..deec4fd 100644
--- a/Tests/FindDoxygen/SimpleTest/CMakeLists.txt
+++ b/Tests/FindDoxygen/SimpleTest/CMakeLists.txt
@@ -22,6 +22,7 @@ else()
message(FATAL_ERROR "Import target Doxygen::doxygen not defined")
endif()
+set(DOXYGEN_OUTPUT_DIRECTORY noArgs)
doxygen_add_docs(docsNoArgs)
if(NOT EXISTS "${PROJECT_BINARY_DIR}/Doxyfile.docsNoArgs")
message(FATAL_ERROR "Missing generated file: Doxyfile.docsNoArgs")
@@ -30,6 +31,7 @@ if(NOT TARGET docsNoArgs)
message(FATAL_ERROR "Target docsNoArgs not created")
endif()
+set(DOXYGEN_OUTPUT_DIRECTORY withArgs)
configure_file(spaces_in_name.cpp.in "spaces in name.cpp" COPYONLY)
doxygen_add_docs(docsWithArgs
"${CMAKE_CURRENT_BINARY_DIR}/spaces in name.cpp"
diff --git a/Tests/FindDoxygen/StampFile/CMakeLists.txt b/Tests/FindDoxygen/StampFile/CMakeLists.txt
index 2d06540..ed2bfbb 100644
--- a/Tests/FindDoxygen/StampFile/CMakeLists.txt
+++ b/Tests/FindDoxygen/StampFile/CMakeLists.txt
@@ -3,22 +3,41 @@ project(TestFindDoxygen VERSION 1.0 LANGUAGES NONE)
find_package(Doxygen REQUIRED)
+set(DOXYGEN_OUTPUT_DIRECTORY noFiles)
doxygen_add_docs(docsWithoutFilesWithStamp USE_STAMP_FILE)
if(NOT EXISTS "${PROJECT_BINARY_DIR}/Doxyfile.docsWithoutFilesWithStamp")
- message(FATAL_ERROR "Missing generated file: Doxyfile.docsWithoutFilesWithStamp")
+ message(FATAL_ERROR "Missing generated file: Doxyfile.docsWithoutFilesWithStamp")
endif()
if(NOT TARGET docsWithoutFilesWithStamp)
- message(FATAL_ERROR "Target docsWithoutFilesWithStamp not created")
+ message(FATAL_ERROR "Target docsWithoutFilesWithStamp not created")
endif()
+set(DOXYGEN_OUTPUT_DIRECTORY withFiles)
doxygen_add_docs(docsWithFilesWithStamp main.cpp main2.cpp USE_STAMP_FILE)
if(NOT EXISTS "${PROJECT_BINARY_DIR}/Doxyfile.docsWithFilesWithStamp")
- message(FATAL_ERROR "Missing generated file: Doxyfile.docsWithFilesWithStamp")
+ message(FATAL_ERROR "Missing generated file: Doxyfile.docsWithFilesWithStamp")
endif()
if(NOT TARGET docsWithFilesWithStamp)
- message(FATAL_ERROR "Target docsWithFilesWithStamp not created")
+ message(FATAL_ERROR "Target docsWithFilesWithStamp not created")
endif()
+# Confirm that doxygen_add_docs() doesn't cause a fatal error if given a
+# source file that is generated at build time
+file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/genDox.cpp)
+add_custom_command(OUTPUT genDox.cpp
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/main2.cpp genDox.cpp
+ DEPENDS main2.cpp
+)
+set(DOXYGEN_OUTPUT_DIRECTORY withGenFiles)
+doxygen_add_docs(docsWithGenFilesWithStamp
+ main.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/genDox.cpp
+ USE_STAMP_FILE
+)
add_custom_target(allDocTargets)
-add_dependencies(allDocTargets docsWithoutFilesWithStamp docsWithFilesWithStamp)
+add_dependencies(allDocTargets
+ docsWithoutFilesWithStamp
+ docsWithFilesWithStamp
+ docsWithGenFilesWithStamp
+)
diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt
index 072a993..fdfa36e 100644
--- a/Tests/FindPython/CMakeLists.txt
+++ b/Tests/FindPython/CMakeLists.txt
@@ -150,6 +150,99 @@ if(CMake_TEST_FindPython)
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
+ add_test(NAME FindPython.Python2.ExactVersion.LOCATION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python2.ExactVersion.LOCATION"
+ ${build_generator_args}
+ --build-project TestExactVersion
+ --build-options ${build_options} -DPython_MAJOR_VERSION=2
+ -DPython_REQUESTED_VERSION=2.1.2
+ -DPython2_FIND_STRATEGY=LOCATION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.Python2.ExactVersion.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python2.ExactVersion.VERSION"
+ ${build_generator_args}
+ --build-project TestExactVersion
+ --build-options ${build_options} -DPython_MAJOR_VERSION=2
+ -DPython_REQUESTED_VERSION=2.1.2
+ -DPython2_FIND_STRATEGY=VERSION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.Python3.ExactVersion.LOCATION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python3.ExactVersion.LOCATION"
+ ${build_generator_args}
+ --build-project TestExactVersion
+ --build-options ${build_options} -DPython_MAJOR_VERSION=3
+ -DPython_REQUESTED_VERSION=3.1.2
+ -DPython3_FIND_STRATEGY=LOCATION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.Python3.ExactVersion.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python3.ExactVersion.VERSION"
+ ${build_generator_args}
+ --build-project TestExactVersion
+ --build-options ${build_options} -DPython_MAJOR_VERSION=3
+ -DPython_REQUESTED_VERSION=3.1.2
+ -DPython3_FIND_STRATEGY=VERSION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.Python.V2.ExactVersion.LOCATION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.ExactVersion.LOCATION"
+ ${build_generator_args}
+ --build-project TestExactVersion
+ --build-options ${build_options} -DPython_REQUESTED_VERSION=2.1.2
+ -DPython_FIND_STRATEGY=LOCATION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.Python.V2.ExactVersion.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.ExactVersion.VERSION"
+ ${build_generator_args}
+ --build-project TestExactVersion
+ --build-options ${build_options} -DPython_REQUESTED_VERSION=2.1.2
+ -DPython_FIND_STRATEGY=VERSION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.Python.V3.ExactVersion.LOCATION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python.V3.ExactVersion.LOCATION"
+ ${build_generator_args}
+ --build-project TestExactVersion
+ --build-options ${build_options} -DPython_REQUESTED_VERSION=3.1.2
+ -DPython_FIND_STRATEGY=LOCATION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.Python.V3.ExactVersion.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python.V3.ExactVersion.VERSION"
+ ${build_generator_args}
+ --build-project TestExactVersion
+ --build-options ${build_options} -DPython_REQUESTED_VERSION=3.1.2
+ -DPython_FIND_STRATEGY=VERSION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+
add_test(NAME FindPython.MultiplePackages COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -400,3 +493,108 @@ if(CMake_TEST_FindPython_IronPython)
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
endif()
+
+if(CMake_TEST_FindPython_PyPy)
+ add_test(NAME FindPython.PyPy2.LOCATION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy2"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy2.LOCATION"
+ ${build_generator_args}
+ --build-project TestPyPy2
+ --build-options ${build_options} -DPython2_FIND_STRATEGY=LOCATION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.PyPy2.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy2"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy2.VERSION"
+ ${build_generator_args}
+ --build-project TestPyPy2
+ --build-options ${build_options} -DPython2_FIND_STRATEGY=VERSION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+
+ add_test(NAME FindPython.PyPy3.LOCATION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy3"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy3.LOCATION"
+ ${build_generator_args}
+ --build-project TestPyPy3
+ --build-options ${build_options} -DPython3_FIND_STRATEGY=LOCATION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.PyPy3.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy3"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy3.VERSION"
+ ${build_generator_args}
+ --build-project TestPyPy3
+ --build-options ${build_options} -DPython3_FIND_STRATEGY=VERSION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+
+ add_test(NAME FindPython.PyPy.LOCATION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.LOCATION"
+ ${build_generator_args}
+ --build-project TestPyPy
+ --build-options ${build_options} -DPython_FIND_STRATEGY=LOCATION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.PyPy.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.VERSION"
+ ${build_generator_args}
+ --build-project TestPyPy
+ --build-options ${build_options} -DPython_FIND_STRATEGY=VERSION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.PyPy.V2.LOCATION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V2.LOCATION"
+ ${build_generator_args}
+ --build-project TestPyPy
+ --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=LOCATION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.PyPy.V2.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V2.VERSION"
+ ${build_generator_args}
+ --build-project TestPyPy
+ --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=VERSION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.PyPy.V3.LOCATION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V3.LOCATION"
+ ${build_generator_args}
+ --build-project TestPyPy
+ --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_FIND_STRATEGY=LOCATION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.PyPy.V3.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V3.VERSION"
+ ${build_generator_args}
+ --build-project TestPyPy
+ --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_FIND_STRATEGY=VERSION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+endif()
diff --git a/Tests/FindPython/ExactVersion/CMakeLists.txt b/Tests/FindPython/ExactVersion/CMakeLists.txt
new file mode 100644
index 0000000..e09f73a
--- /dev/null
+++ b/Tests/FindPython/ExactVersion/CMakeLists.txt
@@ -0,0 +1,56 @@
+cmake_minimum_required(VERSION 3.1)
+
+project(TestExactVersion C)
+
+find_package(Python${Python_MAJOR_VERSION} ${Python_REQUESTED_VERSION} COMPONENTS Interpreter Development)
+if (NOT Python${Python_MAJOR_VERSION}_FOUND)
+ message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}")
+endif()
+if (NOT Python${Python_MAJOR_VERSION}_Interpreter_FOUND)
+ message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION} Interpreter")
+endif()
+if (NOT Python${Python_MAJOR_VERSION}_Development_FOUND)
+ message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION} Development")
+endif()
+
+if(NOT TARGET Python${Python_MAJOR_VERSION}::Interpreter)
+ message(SEND_ERROR "Python${Python_MAJOR_VERSION}::Interpreter not found")
+endif()
+
+if(NOT TARGET Python${Python_MAJOR_VERSION}::Python)
+ message(SEND_ERROR "Python${Python_MAJOR_VERSION}::Python not found")
+endif()
+if(NOT TARGET Python${Python_MAJOR_VERSION}::Module)
+ message(SEND_ERROR "Python${Python_MAJOR_VERSION}::Module not found")
+endif()
+
+
+# reset artifacts and second search with exact version already founded
+unset (Python${Python_MAJOR_VERSION}_EXECUTABLE)
+unset (_Python${Python_MAJOR_VERSION}_EXECUTABLE CACHE)
+
+unset (_Python${Python_MAJOR_VERSION}_LIBRARY_RELEASE CACHE)
+unset (_Python${Python_MAJOR_VERSION}_INCLUDE_DIR CACHE)
+
+set (Python_REQUESTED_VERSION ${Python${Python_MAJOR_VERSION}_VERSION})
+find_package(Python${Python_MAJOR_VERSION} ${Python_REQUESTED_VERSION} EXACT COMPONENTS Interpreter Development)
+if (NOT Python${Python_MAJOR_VERSION}_FOUND)
+ message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}")
+endif()
+if (NOT Python${Python_MAJOR_VERSION}_Interpreter_FOUND)
+ message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION} Interpreter")
+endif()
+if (NOT Python${Python_MAJOR_VERSION}_Development_FOUND)
+ message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION} Development")
+endif()
+
+if(NOT TARGET Python${Python_MAJOR_VERSION}::Interpreter)
+ message(SEND_ERROR "Python${Python_MAJOR_VERSION}::Interpreter not found")
+endif()
+
+if(NOT TARGET Python${Python_MAJOR_VERSION}::Python)
+ message(SEND_ERROR "Python${Python_MAJOR_VERSION}::Python not found")
+endif()
+if(NOT TARGET Python${Python_MAJOR_VERSION}::Module)
+ message(SEND_ERROR "Python${Python_MAJOR_VERSION}::Module not found")
+endif()
diff --git a/Tests/FindPython/PyPy/CMakeLists.txt b/Tests/FindPython/PyPy/CMakeLists.txt
new file mode 100644
index 0000000..b4ade8c
--- /dev/null
+++ b/Tests/FindPython/PyPy/CMakeLists.txt
@@ -0,0 +1,37 @@
+cmake_minimum_required(VERSION 3.1)
+
+project(TestPyPy C)
+
+set (Python_FIND_IMPLEMENTATIONS PyPy)
+
+find_package(Python ${Python_REQUESTED_VERSION} COMPONENTS Interpreter Development)
+if (NOT Python_FOUND)
+ message (FATAL_ERROR "Fail to found Python PyPy ${Python_REQUESTED_VERSION}")
+endif()
+
+if (NOT Python_Interpreter_FOUND)
+ message (FATAL_ERROR "Fail to found Python PyPy Interpreter")
+endif()
+if (NOT Python_INTERPRETER_ID STREQUAL "PyPy")
+ message (FATAL_ERROR "Erroneous interpreter ID (${Python_INTERPRETER_ID})")
+endif()
+
+if (NOT Python_Development.Module_FOUND)
+ message (FATAL_ERROR "Fail to found Python PyPy ${Python_REQUESTED_VERSION} Development.Module")
+endif()
+if (NOT Python_Development.Embed_FOUND)
+ message (FATAL_ERROR "Fail to found Python PyPy ${Python_REQUESTED_VERSION} Development.Embed")
+endif()
+if (NOT Python_Development_FOUND)
+ message (FATAL_ERROR "Fail to found Python PyPy ${Python_REQUESTED_VERSION} Development")
+endif()
+
+if(NOT TARGET Python::Interpreter)
+ message(SEND_ERROR "Python::Interpreter not found")
+endif()
+if(NOT TARGET Python::Module)
+ message(SEND_ERROR "Python::Module not found")
+endif()
+if(NOT TARGET Python::Python)
+ message(SEND_ERROR "Python::Python not found")
+endif()
diff --git a/Tests/FindPython/PyPy2/CMakeLists.txt b/Tests/FindPython/PyPy2/CMakeLists.txt
new file mode 100644
index 0000000..2f0ddc9
--- /dev/null
+++ b/Tests/FindPython/PyPy2/CMakeLists.txt
@@ -0,0 +1,37 @@
+cmake_minimum_required(VERSION 3.1)
+
+project(TestPyPy2 C)
+
+set (Python2_FIND_IMPLEMENTATIONS "PyPy")
+
+find_package(Python2 COMPONENTS Interpreter Development)
+if (NOT Python2_FOUND)
+ message (FATAL_ERROR "Fail to found Python PyPy 2")
+endif()
+
+if (NOT Python2_Interpreter_FOUND)
+ message (FATAL_ERROR "Fail to found Python PyPy 2 Interpreter")
+endif()
+if (NOT Python2_INTERPRETER_ID STREQUAL "PyPy")
+ message (FATAL_ERROR "Erroneous interpreter ID (${Python2_INTERPRETER_ID})")
+endif()
+
+if (NOT Python2_Development.Module_FOUND)
+ message (FATAL_ERROR "Fail to found Python PyPy 2 Development.Module")
+endif()
+if (NOT Python2_Development.Embed_FOUND)
+ message (FATAL_ERROR "Fail to found Python PyPy 2 Development.Embed")
+endif()
+if (NOT Python2_Development_FOUND)
+ message (FATAL_ERROR "Fail to found Python PyPy 2 Development")
+endif()
+
+if(NOT TARGET Python2::Interpreter)
+ message(SEND_ERROR "Python2::Interpreter not found")
+endif()
+if(NOT TARGET Python2::Module)
+ message(SEND_ERROR "Python2::Module not found")
+endif()
+if(NOT TARGET Python2::Python)
+ message(SEND_ERROR "Python2::Python not found")
+endif()
diff --git a/Tests/FindPython/PyPy3/CMakeLists.txt b/Tests/FindPython/PyPy3/CMakeLists.txt
new file mode 100644
index 0000000..5562d57
--- /dev/null
+++ b/Tests/FindPython/PyPy3/CMakeLists.txt
@@ -0,0 +1,37 @@
+cmake_minimum_required(VERSION 3.1)
+
+project(TestPyPy3 C)
+
+set (Python3_FIND_IMPLEMENTATIONS "PyPy")
+
+find_package(Python3 COMPONENTS Interpreter Development)
+if (NOT Python3_FOUND)
+ message (FATAL_ERROR "Fail to found Python PyPy 3")
+endif()
+
+if (NOT Python3_Interpreter_FOUND)
+ message (FATAL_ERROR "Fail to found Python PyPy 3 Interpreter")
+endif()
+if (NOT Python3_INTERPRETER_ID STREQUAL "PyPy")
+ message (FATAL_ERROR "Erroneous interpreter ID (${Python3_INTERPRETER_ID})")
+endif()
+
+if (NOT Python3_Development.Module_FOUND)
+ message (FATAL_ERROR "Fail to found Python PyPy 3 Development.Module")
+endif()
+if (NOT Python3_Development.Embed_FOUND)
+ message (FATAL_ERROR "Fail to found Python PyPy 3 Development.Embed")
+endif()
+if (NOT Python3_Development_FOUND)
+ message (FATAL_ERROR "Fail to found Python PyPy 3 Development")
+endif()
+
+if(NOT TARGET Python3::Interpreter)
+ message(SEND_ERROR "Python3::Interpreter not found")
+endif()
+if(NOT TARGET Python3::Module)
+ message(SEND_ERROR "Python3::Module not found")
+endif()
+if(NOT TARGET Python3::Python)
+ message(SEND_ERROR "Python3::Python not found")
+endif()
diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt
index 4327c2f..d24df2d 100644
--- a/Tests/FortranOnly/CMakeLists.txt
+++ b/Tests/FortranOnly/CMakeLists.txt
@@ -116,3 +116,46 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
set_property(TARGET IntelIfDef PROPERTY Fortran_FORMAT FIXED)
target_compile_definitions(IntelIfDef PRIVATE SOME_DEF)
endif()
+
+# Skip these tests if compiler/version doesn't have preprocessing flags
+if((CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 4.4)
+ OR (CMAKE_Fortran_COMPILER_ID STREQUAL "XL" AND CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 15.1.6))
+ set(test_pp_flags 0)
+else()
+ set(test_pp_flags 1)
+endif()
+
+if(test_pp_flags)
+ # Test that we can always preprocess a target
+ add_executable(preprocess_target preprocess2.f)
+ set_property(TARGET preprocess_target PROPERTY Fortran_PREPROCESS ON)
+
+ # Test that we can preprocess a single source file
+ add_executable(preprocess_source preprocess3.f)
+ set_property(SOURCE preprocess3.f PROPERTY Fortran_PREPROCESS ON)
+endif()
+
+# Test that neither the compiler nor CMake performs unnecessary preprocessing.
+add_library(no_preprocess_target_lower STATIC no_preprocess_target_lower.f)
+target_compile_options(no_preprocess_target_lower PRIVATE -DINTEGER=nonsense)
+set_property(TARGET no_preprocess_target_lower PROPERTY Fortran_PREPROCESS OFF)
+add_library(no_preprocess_source_lower STATIC no_preprocess_source_lower.f)
+target_compile_options(no_preprocess_source_lower PRIVATE -DINTEGER=nonsense)
+set_property(SOURCE no_preprocess_source_lower.f PROPERTY Fortran_PREPROCESS OFF)
+
+# Test that we can explicitly not preprocess a target or source.
+# This will not work on certain compilers due to either missing a
+# "don't preprocess" flag, or due to choice of file extension.
+if(test_pp_flags AND NOT CMAKE_Fortran_COMPILER_ID MATCHES "(Flang|NAG|PGI|SunPro|XL)")
+ add_library(no_preprocess_target STATIC no_preprocess_target_upper.F)
+ target_compile_options(no_preprocess_target PRIVATE -DINTEGER=nonsense)
+ add_library(no_preprocess_source STATIC no_preprocess_source_upper.F)
+ target_compile_options(no_preprocess_source PRIVATE -DINTEGER=nonsense)
+ if(NOT CMAKE_Fortran_COMPILER_ID STREQUAL "Cray"
+ AND NOT "${CMAKE_Fortran_COMPILER_ID};${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "Intel;MSVC")
+ target_sources(no_preprocess_target PRIVATE no_preprocess_target_fpp.fpp)
+ target_sources(no_preprocess_source PRIVATE no_preprocess_source_fpp.fpp)
+ endif()
+ set_property(TARGET no_preprocess_target PROPERTY Fortran_PREPROCESS OFF)
+ set_property(SOURCE no_preprocess_source_upper.F no_preprocess_source_fpp.fpp PROPERTY Fortran_PREPROCESS OFF)
+endif()
diff --git a/Tests/FortranOnly/no_preprocess_source_fpp.fpp b/Tests/FortranOnly/no_preprocess_source_fpp.fpp
new file mode 100644
index 0000000..8e48902
--- /dev/null
+++ b/Tests/FortranOnly/no_preprocess_source_fpp.fpp
@@ -0,0 +1,3 @@
+ SUBROUTINE NOPREPROCESS_SOURCE_FPP
+ INTEGER F
+ END
diff --git a/Tests/FortranOnly/no_preprocess_source_lower.f b/Tests/FortranOnly/no_preprocess_source_lower.f
new file mode 100644
index 0000000..3b08782
--- /dev/null
+++ b/Tests/FortranOnly/no_preprocess_source_lower.f
@@ -0,0 +1,3 @@
+ SUBROUTINE NOPREPROCESS_SOURCE_LOWER
+ INTEGER F
+ END
diff --git a/Tests/FortranOnly/no_preprocess_source_upper.F b/Tests/FortranOnly/no_preprocess_source_upper.F
new file mode 100644
index 0000000..02485c9
--- /dev/null
+++ b/Tests/FortranOnly/no_preprocess_source_upper.F
@@ -0,0 +1,3 @@
+ SUBROUTINE NOPREPROCESS_SOURCE_UPPER
+ INTEGER F
+ END
diff --git a/Tests/FortranOnly/no_preprocess_target_fpp.fpp b/Tests/FortranOnly/no_preprocess_target_fpp.fpp
new file mode 100644
index 0000000..f9e6e3b
--- /dev/null
+++ b/Tests/FortranOnly/no_preprocess_target_fpp.fpp
@@ -0,0 +1,3 @@
+ SUBROUTINE NOPREPROCESS_TARGET_FPP
+ INTEGER F
+ END
diff --git a/Tests/FortranOnly/no_preprocess_target_lower.f b/Tests/FortranOnly/no_preprocess_target_lower.f
new file mode 100644
index 0000000..ea23a70
--- /dev/null
+++ b/Tests/FortranOnly/no_preprocess_target_lower.f
@@ -0,0 +1,3 @@
+ SUBROUTINE NOPREPROCESS_TARGET_LOWER
+ INTEGER F
+ END
diff --git a/Tests/FortranOnly/no_preprocess_target_upper.F b/Tests/FortranOnly/no_preprocess_target_upper.F
new file mode 100644
index 0000000..34ee04d
--- /dev/null
+++ b/Tests/FortranOnly/no_preprocess_target_upper.F
@@ -0,0 +1,3 @@
+ SUBROUTINE NOPREPROCESS_TARGET_UPPER
+ INTEGER F
+ END
diff --git a/Tests/FortranOnly/preprocess2.f b/Tests/FortranOnly/preprocess2.f
new file mode 100644
index 0000000..6595d62
--- /dev/null
+++ b/Tests/FortranOnly/preprocess2.f
@@ -0,0 +1,4 @@
+#define int INTEGER
+ PROGRAM PREPRO
+ int f
+ END
diff --git a/Tests/FortranOnly/preprocess3.f b/Tests/FortranOnly/preprocess3.f
new file mode 100644
index 0000000..6595d62
--- /dev/null
+++ b/Tests/FortranOnly/preprocess3.f
@@ -0,0 +1,4 @@
+#define int INTEGER
+ PROGRAM PREPRO
+ int f
+ END
diff --git a/Tests/Properties/CMakeLists.txt b/Tests/Properties/CMakeLists.txt
index a263061..f93f553 100644
--- a/Tests/Properties/CMakeLists.txt
+++ b/Tests/Properties/CMakeLists.txt
@@ -144,4 +144,143 @@ set_property(CACHE SOME_ENTRY PROPERTY ADVANCED "${expect_ADVANCED}")
set_property(CACHE SOME_ENTRY PROPERTY STRINGS "${expect_STRINGS}")
check_cache_props()
+function(generate_file_for_set_property_test i target_name)
+ set(src_path "${CMAKE_CURRENT_BINARY_DIR}/src${i}.cpp")
+ file(GENERATE OUTPUT "${src_path}" CONTENT
+ "#ifndef def${i}\n\
+ #error Expected def${i}\n\
+ #endif\n\
+ #ifdef _WIN32\n\
+ __declspec(dllexport)\n\
+ #endif\n\
+ void dummy_symbol${i}() {}\n")
+ target_sources(${target_name} PRIVATE "${src_path}")
+endfunction()
+
+add_library(maindirtest SHARED)
add_subdirectory(SubDir2)
+
+set(src_prefix "${CMAKE_CURRENT_BINARY_DIR}/SubDir2/")
+
+# Set property + target directory
+set_property(SOURCE "${src_prefix}/src1.cpp"
+ TARGET_DIRECTORY set_prop_lib_1
+ PROPERTY COMPILE_DEFINITIONS def1)
+
+# Append property + target directory
+set_property(SOURCE "${src_prefix}/src2.cpp"
+ TARGET_DIRECTORY set_prop_lib_1
+ APPEND PROPERTY COMPILE_DEFINITIONS def2)
+
+# Set property + relative directory path
+set_property(SOURCE "${src_prefix}/src3.cpp"
+ DIRECTORY SubDir2
+ PROPERTY COMPILE_DEFINITIONS def3)
+
+# Set property + absolute directory path
+set_property(SOURCE "${src_prefix}/src4.cpp"
+ DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/SubDir2"
+ PROPERTY COMPILE_DEFINITIONS def4)
+
+# Append property + relative directory path
+set_property(SOURCE "${src_prefix}/src5.cpp"
+ DIRECTORY SubDir2
+ APPEND PROPERTY COMPILE_DEFINITIONS def5)
+
+# Append property + absolute directory path
+set_property(SOURCE "${src_prefix}/src6.cpp"
+ DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/SubDir2"
+ APPEND PROPERTY COMPILE_DEFINITIONS def6)
+
+
+# Target directory
+set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src10.cpp"
+ TARGET_DIRECTORY set_prop_lib_1
+ PROPERTIES COMPILE_DEFINITIONS def10)
+
+# Relative directory path
+set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src11.cpp"
+ DIRECTORY SubDir2
+ PROPERTIES COMPILE_DEFINITIONS def11)
+
+# Absolute directory path
+set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src12.cpp"
+ DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/SubDir2"
+ PROPERTIES COMPILE_DEFINITIONS def12)
+
+
+# Multiple files + absolute directory path
+set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src20.cpp"
+ "${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src21.cpp"
+ DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/SubDir2"
+ PROPERTIES COMPILE_DEFINITIONS "def20;def21")
+
+# Multiple files + multiple target directories
+set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src22.cpp"
+ "${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src23.cpp"
+ TARGET_DIRECTORY set_prop_lib_2 set_prop_lib_3
+ PROPERTIES COMPILE_DEFINITIONS "def22;def23")
+
+
+# Multiple files in multiple relative directories
+generate_file_for_set_property_test(30 maindirtest)
+set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/src30.cpp"
+ "${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src31.cpp"
+ DIRECTORY . SubDir2
+ PROPERTIES COMPILE_DEFINITIONS "def30;def31")
+
+# Check that specifying files without any properties doesn't crash.
+set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/src30.cpp"
+ "${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src31.cpp")
+
+function(check_get_property_value expected)
+ if(NOT actual STREQUAL expected)
+ message(SEND_ERROR "Error: get_property returned unexpected value\n"
+ "actual: ${actual}\n"
+ "expected: ${expected}")
+ endif()
+endfunction()
+
+# Get property + target directory
+get_property(actual
+ SOURCE "${src_prefix}/src1.cpp"
+ TARGET_DIRECTORY set_prop_lib_1
+ PROPERTY COMPILE_DEFINITIONS)
+check_get_property_value("def1")
+
+# Get property + relative directory path
+get_property(actual
+ SOURCE "${src_prefix}/src3.cpp"
+ DIRECTORY SubDir2
+ PROPERTY COMPILE_DEFINITIONS)
+check_get_property_value("def3")
+
+# Get property + absolute directory path
+get_property(actual
+ SOURCE "${src_prefix}/src4.cpp"
+ DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/SubDir2"
+ PROPERTY COMPILE_DEFINITIONS)
+check_get_property_value("def4")
+
+
+# Get property + target directory
+unset(actual)
+get_source_file_property(actual
+ "${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src10.cpp"
+ TARGET_DIRECTORY set_prop_lib_1
+ COMPILE_DEFINITIONS)
+check_get_property_value("def10")
+
+# Get property + relative directory path
+get_source_file_property(actual
+ "${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src11.cpp"
+ DIRECTORY SubDir2
+ COMPILE_DEFINITIONS)
+check_get_property_value("def11")
+
+# Get property + absolute directory path
+get_source_file_property(actual
+ "${CMAKE_CURRENT_BINARY_DIR}/SubDir2/src12.cpp"
+ DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/SubDir2"
+ COMPILE_DEFINITIONS)
+check_get_property_value("def12")
diff --git a/Tests/Properties/SubDir2/CMakeLists.txt b/Tests/Properties/SubDir2/CMakeLists.txt
index 377dc83..9b2c79e 100644
--- a/Tests/Properties/SubDir2/CMakeLists.txt
+++ b/Tests/Properties/SubDir2/CMakeLists.txt
@@ -3,3 +3,28 @@ set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/../subdirtest.cxx"
PROPERTIES COMPILE_DEFINITIONS SUBDIR_TEST)
add_executable(subdirtest "${CMAKE_CURRENT_SOURCE_DIR}/../subdirtest.cxx")
+
+# For set_property
+add_library(set_prop_lib_1 SHARED)
+foreach(i RANGE 1 6)
+ generate_file_for_set_property_test(${i} set_prop_lib_1)
+endforeach()
+
+# For set_source_files_properties
+foreach(i RANGE 10 12)
+ generate_file_for_set_property_test(${i} set_prop_lib_1)
+endforeach()
+
+# For set_source_files_properties + multiple files + absolute directory path
+add_library(set_prop_lib_2 SHARED)
+foreach(i RANGE 20 21)
+ generate_file_for_set_property_test(${i} set_prop_lib_1)
+endforeach()
+
+# For set_source_files_properties + multiple files + multiple target directories
+add_library(set_prop_lib_3 SHARED)
+generate_file_for_set_property_test(22 set_prop_lib_2)
+generate_file_for_set_property_test(23 set_prop_lib_3)
+
+# For set_source_files_properties + multiple files in multiple directories
+generate_file_for_set_property_test(31 set_prop_lib_3)
diff --git a/Tests/QtAutogen/Complex/codeeditor.cpp b/Tests/QtAutogen/Complex/codeeditor.cpp
index bb6f405..80d6a55 100644
--- a/Tests/QtAutogen/Complex/codeeditor.cpp
+++ b/Tests/QtAutogen/Complex/codeeditor.cpp
@@ -40,7 +40,10 @@
#include "codeeditor.h"
-#include <QtGui>
+#include <QPainter>
+#include <QSize>
+#include <QTextBlock>
+#include <QWidget>
CodeEditor::CodeEditor(QWidget* parent)
: QPlainTextEdit(parent)
diff --git a/Tests/RunCMake/AndroidTestUtilities/check.cmake b/Tests/RunCMake/AndroidTestUtilities/check.cmake
index ccd4d74..c24a3cd 100644
--- a/Tests/RunCMake/AndroidTestUtilities/check.cmake
+++ b/Tests/RunCMake/AndroidTestUtilities/check.cmake
@@ -13,7 +13,7 @@ function(compare_build_to_expected)
endfunction()
function(check_for_setup_test)
- file(STRINGS "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" output_var REGEX "add_test\\(setup_test.*")
+ file(STRINGS "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" output_var REGEX "add_test\\(\"setup_test\".*")
if(NOT output_var)
set(RunCMake_TEST_FAILED "Could not find the test: setup_test" PARENT_SCOPE)
endif()
diff --git a/Tests/RunCMake/AutoExportDll/AutoExport.cmake b/Tests/RunCMake/AutoExportDll/AutoExport.cmake
index a550005..85eff7e 100644
--- a/Tests/RunCMake/AutoExportDll/AutoExport.cmake
+++ b/Tests/RunCMake/AutoExportDll/AutoExport.cmake
@@ -5,6 +5,10 @@ add_subdirectory(sub)
add_library(objlib OBJECT objlib.c)
set_property(TARGET objlib PROPERTY POSITION_INDEPENDENT_CODE 1)
add_library(autoexport SHARED hello.cxx world.cxx foo.c $<TARGET_OBJECTS:objlib>)
+add_library(autoexport3 SHARED cppCLI.cxx)
+if(MSVC AND NOT MSVC_VERSION VERSION_LESS 1600)
+ set_property(TARGET autoexport3 PROPERTY COMMON_LANGUAGE_RUNTIME "")
+endif()
add_executable(say say.cxx)
if(MSVC)
@@ -18,4 +22,4 @@ if(MSVC)
target_compile_definitions(say PRIVATE HAS_JUSTNOP)
endif()
endif()
-target_link_libraries(say autoexport autoexport2)
+target_link_libraries(say autoexport autoexport2 autoexport3)
diff --git a/Tests/RunCMake/AutoExportDll/cppCLI.cxx b/Tests/RunCMake/AutoExportDll/cppCLI.cxx
new file mode 100644
index 0000000..816bb6e
--- /dev/null
+++ b/Tests/RunCMake/AutoExportDll/cppCLI.cxx
@@ -0,0 +1,22 @@
+#include <stdio.h>
+
+#ifdef __cplusplus_cli
+# include <msclr\marshal_cppstd.h>
+
+void cliFunction()
+{
+ System::String ^ result = "cliFunction";
+ result = result->Trim();
+ printf(msclr::interop::marshal_as<std::string>(result).c_str());
+}
+#else
+void cliFunction()
+{
+ printf("cliFunction (but /cli was not passed to the compiler)");
+}
+#endif
+
+void nonCliFunction()
+{
+ printf("nonCliFunction");
+}
diff --git a/Tests/RunCMake/AutoExportDll/say.cxx b/Tests/RunCMake/AutoExportDll/say.cxx
index 654b5e0..8fc768a 100644
--- a/Tests/RunCMake/AutoExportDll/say.cxx
+++ b/Tests/RunCMake/AutoExportDll/say.cxx
@@ -17,9 +17,11 @@ void justnop();
}
// test c++ functions
-// forward declare hello and world
+// forward declare hello, world, cliFunction and nonCliFunction
void hello();
void world();
+void cliFunction();
+void nonCliFunction();
// test exports for executable target
extern "C" {
@@ -44,6 +46,10 @@ int main()
bar();
objlib();
printf("\n");
+ cliFunction();
+ printf("\n");
+ nonCliFunction();
+ printf("\n");
#ifdef HAS_JUSTNOP
justnop();
#endif
diff --git a/Tests/RunCMake/BuildDepends/ExternalProject/CMakeLists.txt b/Tests/RunCMake/BuildDepends/ExternalProject/CMakeLists.txt
new file mode 100644
index 0000000..57a0f6e
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/ExternalProject/CMakeLists.txt
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.12)
+project(External NONE)
+
+if (DEFINED cache_arg)
+ message("configured with: ${cache_arg}")
+else ()
+ message("cache_arg is undefined")
+endif ()
+
+if (DEFINED second_cache_arg)
+ message("configured again with: ${second_cache_arg}")
+else ()
+ message("second_cache_arg is undefined")
+endif ()
diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build1-stdout.txt b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build1-stdout.txt
new file mode 100644
index 0000000..fea7fd9
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build1-stdout.txt
@@ -0,0 +1,2 @@
+.*configured with: first
+.*second_cache_arg is undefined
diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build2-stdout.txt b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build2-stdout.txt
new file mode 100644
index 0000000..e19e743
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build2-stdout.txt
@@ -0,0 +1,2 @@
+.*configured with: first
+.*configured again with: second
diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.cmake b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.cmake
new file mode 100644
index 0000000..fe69426
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.cmake
@@ -0,0 +1,19 @@
+include("${CMAKE_CURRENT_BINARY_DIR}/data.cmake")
+
+include(ExternalProject)
+ExternalProject_add(external
+ SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/ExternalProject"
+ CMAKE_CACHE_ARGS
+ ${cache_args}
+ BUILD_COMMAND ""
+ INSTALL_COMMAND "")
+
+set(cache_args_path "<TMP_DIR>/external-cache-$<CONFIG>.cmake")
+set(cmake_cache_path "<BINARY_DIR>/CMakeCache.txt")
+_ep_replace_location_tags(external cache_args_path cmake_cache_path)
+
+file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake" CONTENT "
+set(check_pairs
+ \"${cmake_cache_path}|${cache_args_path}\"
+)
+")
diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step1.cmake b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step1.cmake
new file mode 100644
index 0000000..57c7ab7
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step1.cmake
@@ -0,0 +1,3 @@
+file(WRITE "${RunCMake_TEST_BINARY_DIR}/data.cmake"
+ "set(cache_args -Dcache_arg:STRING=first)
+")
diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step2.cmake b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step2.cmake
new file mode 100644
index 0000000..cbb79e1
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step2.cmake
@@ -0,0 +1,3 @@
+file(WRITE "${RunCMake_TEST_BINARY_DIR}/data.cmake"
+ "set(cache_args -Dsecond_cache_arg:STRING=second)
+")
diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
index 753417d..7a68c4b 100644
--- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
+++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
@@ -46,6 +46,11 @@ endif()
run_BuildDepends(Custom-Symbolic-and-Byproduct)
run_BuildDepends(Custom-Always)
+set(RunCMake_TEST_OUTPUT_MERGE_save "${RunCMake_TEST_OUTPUT_MERGE}")
+set(RunCMake_TEST_OUTPUT_MERGE 1)
+run_BuildDepends(ExternalProjectCacheArgs)
+set(RunCMake_TEST_OUTPUT_MERGE "${RunCMake_TEST_OUTPUT_MERGE_save}")
+
# Test header dependencies with a build tree underneath a source tree.
set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/BuildUnderSource")
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/BuildUnderSource/build")
diff --git a/Tests/RunCMake/CMP0104/CMP0104-WARN.cmake b/Tests/RunCMake/CMP0104/CMP0104-WARN.cmake
index 841d0a8..2b4a8f5 100644
--- a/Tests/RunCMake/CMP0104/CMP0104-WARN.cmake
+++ b/Tests/RunCMake/CMP0104/CMP0104-WARN.cmake
@@ -1 +1,2 @@
include(CMP0104-Common.cmake)
+set_property(TARGET cuda PROPERTY CUDA_ARCHITECTURES)
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index e757dd4..5f3f38b 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -197,6 +197,9 @@ endif()
add_RunCMake_test(CompilerNotFound)
add_RunCMake_test(Configure -DMSVC_IDE=${MSVC_IDE})
add_RunCMake_test(DisallowedCommands)
+if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja")
+ add_RunCMake_test(ExportCompileCommands)
+endif()
add_RunCMake_test(ExternalData)
add_RunCMake_test(FeatureSummary)
add_RunCMake_test(FPHSA)
@@ -270,6 +273,7 @@ add_RunCMake_test(add_dependencies)
add_RunCMake_test(add_executable)
add_RunCMake_test(add_library)
add_RunCMake_test(add_subdirectory)
+add_RunCMake_test(add_test)
add_RunCMake_test(build_command)
add_executable(exit_code exit_code.c)
set(execute_process_ARGS -DEXIT_CODE_EXE=$<TARGET_FILE:exit_code>)
@@ -278,6 +282,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
endif()
add_RunCMake_test(execute_process)
add_RunCMake_test(export)
+add_RunCMake_test(cmake_language)
add_RunCMake_test(cmake_minimum_required)
add_RunCMake_test(cmake_parse_arguments)
add_RunCMake_test(continue)
@@ -673,5 +678,3 @@ add_RunCMake_test("CTestCommandExpandLists")
add_RunCMake_test(PrecompileHeaders -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID})
add_RunCMake_test("UnityBuild")
-
-add_RunCMake_test(cmake_command)
diff --git a/Tests/RunCMake/CTestResourceAllocation/RunCMakeTest.cmake b/Tests/RunCMake/CTestResourceAllocation/RunCMakeTest.cmake
index 777f192..e9aa3a4 100644
--- a/Tests/RunCMake/CTestResourceAllocation/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestResourceAllocation/RunCMakeTest.cmake
@@ -38,6 +38,13 @@ function(run_ctresalloc_verify name tests)
run_cmake_command(${name} "${CTRESALLOC_COMMAND}" verify "${RunCMake_SOURCE_DIR}/${name}.log" "${CMAKE_CURRENT_LIST_DIR}/resspec.json" "${tests}")
endfunction()
+function(read_testing_file filename variable)
+ file(READ "${RunCMake_TEST_BINARY_DIR}/Testing/TAG" _tag)
+ string(REGEX REPLACE "^([^\n]*)\n.*$" "\\1" _date "${_tag}")
+ file(READ "${RunCMake_TEST_BINARY_DIR}/Testing/${_date}/${filename}" _contents)
+ set("${variable}" "${_contents}" PARENT_SCOPE)
+endfunction()
+
unset(ENV{CTEST_RESOURCE_GROUP_COUNT})
set(RunCMake_TEST_NO_CLEAN 1)
file(REMOVE_RECURSE "${RunCMake_BINARY_DIR}/ctresalloc-write-proc-good1-build")
diff --git a/Tests/RunCMake/CTestResourceAllocation/process_count-ctest-s-nores-check.cmake b/Tests/RunCMake/CTestResourceAllocation/process_count-ctest-s-nores-check.cmake
new file mode 100644
index 0000000..c6e72bd
--- /dev/null
+++ b/Tests/RunCMake/CTestResourceAllocation/process_count-ctest-s-nores-check.cmake
@@ -0,0 +1,4 @@
+read_testing_file("Test.xml" _test_contents)
+if(NOT _test_contents MATCHES "#CTEST_RESOURCE_GROUP_COUNT=")
+ string(APPEND RunCMake_TEST_FAILED "Could not find unset variable CTEST_RESOURCE_GROUP_COUNT in test measurements\n")
+endif()
diff --git a/Tests/RunCMake/CTestResourceAllocation/process_count-ctest-s-res-check.cmake b/Tests/RunCMake/CTestResourceAllocation/process_count-ctest-s-res-check.cmake
index ceda72e..585c36b 100644
--- a/Tests/RunCMake/CTestResourceAllocation/process_count-ctest-s-res-check.cmake
+++ b/Tests/RunCMake/CTestResourceAllocation/process_count-ctest-s-res-check.cmake
@@ -1 +1,9 @@
verify_ctest_resources()
+
+read_testing_file("Test.xml" _test_contents)
+if(NOT _test_contents MATCHES "\nCTEST_RESOURCE_GROUP_0=widgets")
+ string(APPEND RunCMake_TEST_FAILED "Could not find variable CTEST_RESOURCE_GROUP_0 in test measurements\n")
+endif()
+if(NOT _test_contents MATCHES "\nCTEST_RESOURCE_GROUP_0_WIDGETS=id:")
+ string(APPEND RunCMake_TEST_FAILED "Could not find variable CTEST_RESOURCE_GROUP_0_WIDGETS in test measurements\n")
+endif()
diff --git a/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake b/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake
new file mode 100644
index 0000000..29faae3
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake
@@ -0,0 +1,3 @@
+if(NOT ("${CMAKE_ARGV3}" STREQUAL "--" AND "${CMAKE_ARGV4}" STREQUAL "-DFOO"))
+ message(FATAL_ERROR "`-DFOO` shouldn't trigger an error after `--`")
+endif()
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 0f806bc..973391d 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -46,6 +46,7 @@ run_cmake_command(G_no-arg ${CMAKE_COMMAND} -B DummyBuildDir -G)
run_cmake_command(G_bad-arg ${CMAKE_COMMAND} -B DummyBuildDir -G NoSuchGenerator)
run_cmake_command(P_no-arg ${CMAKE_COMMAND} -P)
run_cmake_command(P_no-file ${CMAKE_COMMAND} -P nosuchscriptfile.cmake)
+run_cmake_command(P_arbitrary_args ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/P_arbitrary_args.cmake" -- -DFOO)
run_cmake_command(build-no-dir
${CMAKE_COMMAND} --build)
diff --git a/Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h b/Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h
index bf56ec6..2d39178 100644
--- a/Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h
+++ b/Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h
Binary files differ
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake
index 588b77b..3cbbc07 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake
@@ -7,22 +7,22 @@ endif()
set(error_details "There is a problem with generated test file: ${testfile}")
-if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulator [^\n]+pseudo_emulator[^\n]+\n")
+if(testfile_contents MATCHES "add_test[(][\"]DoesNotUseEmulator[\"] [^\n]+pseudo_emulator[^\n]+\n")
message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
endif()
-if(NOT testfile_contents MATCHES "add_test[(]UsesEmulator [^\n]+pseudo_emulator[^\n]+\n")
+if(NOT testfile_contents MATCHES "add_test[(][\"]UsesEmulator[\"] [^\n]+pseudo_emulator[^\n]+\n")
message(SEND_ERROR "Did not use emulator when it should be used. ${error_details}")
endif()
-if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithGenex [^\n]+pseudo_emulator[^\n]+\n")
+if(testfile_contents MATCHES "add_test[(][\"]DoesNotUseEmulatorWithGenex[\"] [^\n]+pseudo_emulator[^\n]+\n")
message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
endif()
-if(NOT testfile_contents MATCHES "add_test[(]UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex [^\n]+pseudo_emulator[^\n]+\n")
+if(NOT testfile_contents MATCHES "add_test[(][\"]UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex[\"] [^\n]+pseudo_emulator[^\n]+\n")
message(SEND_ERROR "Did not use emulator when it should be used. ${error_details}")
endif()
-if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex [^\n]+pseudo_emulator[^\n]+\n")
+if(testfile_contents MATCHES "add_test[(][\"]DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex[\"] [^\n]+pseudo_emulator[^\n]+\n")
message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
endif()
diff --git a/Tests/RunCMake/ExportCompileCommands/BeforeProject-check.cmake b/Tests/RunCMake/ExportCompileCommands/BeforeProject-check.cmake
new file mode 100644
index 0000000..87058e2
--- /dev/null
+++ b/Tests/RunCMake/ExportCompileCommands/BeforeProject-check.cmake
@@ -0,0 +1,4 @@
+if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/compile_commands.json")
+ set(RunCMake_TEST_FAILED "compile_commands.json not generated")
+ return()
+endif()
diff --git a/Tests/RunCMake/ExportCompileCommands/BeforeProject.cmake b/Tests/RunCMake/ExportCompileCommands/BeforeProject.cmake
new file mode 100644
index 0000000..b8cbdef
--- /dev/null
+++ b/Tests/RunCMake/ExportCompileCommands/BeforeProject.cmake
@@ -0,0 +1,3 @@
+enable_language(C)
+add_library(empty STATIC empty.c)
+message(STATUS "CMAKE_EXPORT_COMPILE_COMMANDS='${CMAKE_EXPORT_COMPILE_COMMANDS}'")
diff --git a/Tests/RunCMake/ExportCompileCommands/BeforeProjectBEFORE.cmake b/Tests/RunCMake/ExportCompileCommands/BeforeProjectBEFORE.cmake
new file mode 100644
index 0000000..87f9c87
--- /dev/null
+++ b/Tests/RunCMake/ExportCompileCommands/BeforeProjectBEFORE.cmake
@@ -0,0 +1 @@
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
diff --git a/Tests/RunCMake/ExportCompileCommands/CMakeLists.txt b/Tests/RunCMake/ExportCompileCommands/CMakeLists.txt
new file mode 100644
index 0000000..b7117bd
--- /dev/null
+++ b/Tests/RunCMake/ExportCompileCommands/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.17)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake b/Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake
new file mode 100644
index 0000000..b540a04
--- /dev/null
+++ b/Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake_with_options(BeforeProject -DCMAKE_PROJECT_INCLUDE_BEFORE=BeforeProjectBEFORE.cmake)
diff --git a/Tests/RunCMake/ExportCompileCommands/empty.c b/Tests/RunCMake/ExportCompileCommands/empty.c
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/ExportCompileCommands/empty.c
diff --git a/Tests/RunCMake/FetchContent/MakeAvailable-stdout.txt b/Tests/RunCMake/FetchContent/MakeAvailable-stdout.txt
index 6e6c730..711de6b 100644
--- a/Tests/RunCMake/FetchContent/MakeAvailable-stdout.txt
+++ b/Tests/RunCMake/FetchContent/MakeAvailable-stdout.txt
@@ -1,2 +1,3 @@
Confirmation project has been added
+.*Confirmation subproject has been added
.*Confirmation script has been called
diff --git a/Tests/RunCMake/FetchContent/MakeAvailable.cmake b/Tests/RunCMake/FetchContent/MakeAvailable.cmake
index a93f1f7..d7fc55c 100644
--- a/Tests/RunCMake/FetchContent/MakeAvailable.cmake
+++ b/Tests/RunCMake/FetchContent/MakeAvailable.cmake
@@ -8,13 +8,22 @@ FetchContent_Declare(
WithoutProject
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/WithoutProject
)
+FetchContent_Declare(
+ ProjectSubdir
+ SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/WithoutProject
+ SOURCE_SUBDIR ProjectSubdir
+)
# Order is important and will be verified by test output
-FetchContent_MakeAvailable(WithProject WithoutProject)
+FetchContent_MakeAvailable(WithProject WithoutProject ProjectSubdir)
get_property(addedWith GLOBAL PROPERTY FetchWithProject SET)
if(NOT addedWith)
- message(SEND_ERROR "Subdir with CMakeLists.txt not added")
+ message(SEND_ERROR "Project with top level CMakeLists.txt not added")
+endif()
+get_property(addedSubdir GLOBAL PROPERTY FetchWithSubProject SET)
+if(NOT addedSubdir)
+ message(SEND_ERROR "Project with CMakeLists.txt in subdir not added")
endif()
include(${withoutproject_SOURCE_DIR}/confirmMessage.cmake)
diff --git a/Tests/RunCMake/FetchContent/WithoutProject/ProjectSubdir/CMakeLists.txt b/Tests/RunCMake/FetchContent/WithoutProject/ProjectSubdir/CMakeLists.txt
new file mode 100644
index 0000000..216eeb1
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/WithoutProject/ProjectSubdir/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.13)
+project(ProjectSubdir LANGUAGES NONE)
+
+set_property(GLOBAL PROPERTY FetchWithSubProject YES)
+message(STATUS "Confirmation subproject has been added")
diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake
index 62bb5de..d697fc6 100644
--- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake
+++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake
@@ -99,6 +99,7 @@ file(WRITE ${fakePkgDir}/lib/pkgconfig/${pname}.pc
Description: Dummy package for FindPkgConfig IMPORTED_TARGET INTERFACE_LINK_OPTIONS test
Version: 1.2.3
Libs: -e dummy_main
+Cflags: -I/special -isystem /other -isystem/more -DA-isystem/foo
")
set(expected_link_options -e dummy_main)
@@ -109,7 +110,26 @@ endif()
get_target_property(link_options PkgConfig::FakeLinkOptionsPackage INTERFACE_LINK_OPTIONS)
if (NOT link_options STREQUAL expected_link_options)
message(FATAL_ERROR
- "Additional link options not present in INTERFACE_LINK_OPTIONS property"
+ "Additional link options not present in INTERFACE_LINK_OPTIONS property\n"
"expected: \"${expected_link_options}\", but got \"${link_options}\""
)
endif()
+
+get_target_property(inc_dirs PkgConfig::FakeLinkOptionsPackage INTERFACE_INCLUDE_DIRECTORIES)
+set(expected_inc_dirs "/special" "/other" "/more")
+
+if (NOT inc_dirs STREQUAL expected_inc_dirs)
+ message(FATAL_ERROR
+ "Additional include directories not correctly present in INTERFACE_INCLUDE_DIRECTORIES property\n"
+ "expected: \"${expected_inc_dirs}\", got \"${inc_dirs}\""
+ )
+endif ()
+
+get_target_property(c_opts PkgConfig::FakeLinkOptionsPackage INTERFACE_COMPILE_OPTIONS)
+set(expected_c_opts "-DA-isystem/foo") # this is an invalid option, but a good testcase
+if (NOT c_opts STREQUAL expected_c_opts)
+ message(FATAL_ERROR
+ "Additional compile options not present in INTERFACE_COMPILE_OPTIONS property\n"
+ "expected: \"${expected_c_opts}\", got \"${c_opts}\""
+ )
+endif ()
diff --git a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake
index 18c3340..b3977f1 100644
--- a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake
@@ -26,4 +26,12 @@ function(run_GEH)
endforeach()
endfunction()
+# remove these flags from the enviornment if they have been set
+# so the tests run the correct env
+set(env_cxx_flags $ENV{CXXFLAGS})
+if(env_cxx_flags)
+ string(REPLACE "-fvisibility=hidden" "" env_cxx_flags "${env_cxx_flags}")
+ string(REPLACE "-fvisibility-inlines-hidden" "" env_cxx_flags "${env_cxx_flags}")
+ set(ENV{CXXFLAGS} "${env_cxx_flags}")
+endif()
run_GEH()
diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt
index 5f7753d..7fb3919 100644
--- a/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt
+++ b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt
@@ -1,22 +1,28 @@
Test project .*
- Start 1: TEST:basic\.case_foo!1
-1/8 Test #1: TEST:basic\.case_foo!1 \.+ +Passed +[0-9.]+ sec
- Start 2: TEST:basic\.case_bar!1
-2/8 Test #2: TEST:basic\.case_bar!1 \.+ +Passed +[0-9.]+ sec
- Start 3: TEST:basic\.disabled_case!1
-3/8 Test #3: TEST:basic\.disabled_case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec
- Start 4: TEST:disabled\.case!1
-4/8 Test #4: TEST:disabled\.case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec
- Start 5: TEST:typed/short\.case!1
-5/8 Test #5: TEST:typed/short\.case!1 \.+ +Passed +[0-9.]+ sec
- Start 6: TEST:typed/float\.case!1
-6/8 Test #6: TEST:typed/float\.case!1 \.+ +Passed +[0-9.]+ sec
- Start 7: TEST:value/test\.case/1!1
-7/8 Test #7: TEST:value/test\.case/1!1 \.+ +Passed +[0-9.]+ sec
- Start 8: TEST:value/test\.case/"foo"!1
-8/8 Test #8: TEST:value/test\.case/"foo"!1 \.+ +Passed +[0-9.]+ sec
+ Start 1: TEST:basic\.case_foo!1
+ 1/11 Test #1: TEST:basic\.case_foo!1 \.+ +Passed +[0-9.]+ sec
+ Start 2: TEST:basic\.case_bar!1
+ 2/11 Test #2: TEST:basic\.case_bar!1 \.+ +Passed +[0-9.]+ sec
+ Start 3: TEST:basic\.disabled_case!1
+ 3/11 Test #3: TEST:basic\.disabled_case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec
+ Start 4: TEST:disabled\.case!1
+ 4/11 Test #4: TEST:disabled\.case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec
+ Start 5: TEST:typed/short\.case!1
+ 5/11 Test #5: TEST:typed/short\.case!1 \.+ +Passed +[0-9.]+ sec
+ Start 6: TEST:typed/float\.case!1
+ 6/11 Test #6: TEST:typed/float\.case!1 \.+ +Passed +[0-9.]+ sec
+ Start 7: TEST:value/test\.case/1!1
+ 7/11 Test #7: TEST:value/test\.case/1!1 \.+ +Passed +[0-9.]+ sec
+ Start 8: TEST:value/test\.case/"foo"!1
+ 8/11 Test #8: TEST:value/test\.case/"foo"!1 \.+ +Passed +[0-9.]+ sec
+ Start 9: TEST:param/special\.case/"semicolon;"!1
+ 9/11 Test #9: TEST:param/special\.case/"semicolon;"!1 \.+ +Passed +[0-9.]+ sec
+ Start 10: TEST:param/special\.case/"backslash\\"!1
+10/11 Test #10: TEST:param/special\.case/"backslash\\"!1 \.+ +Passed +[0-9.]+ sec
+ Start 11: TEST:param/special\.case/"\$\{var\}"!1
+11/11 Test #11: TEST:param/special\.case/"\$\{var\}"!1 \.+ +Passed +[0-9.]+ sec
-100% tests passed, 0 tests failed out of 6
+100% tests passed, 0 tests failed out of 9
Total Test time \(real\) = +[0-9.]+ sec
diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt
index 960c0b9..58c4d10 100644
--- a/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt
+++ b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt
@@ -1,25 +1,31 @@
Test project .*
- Start 9: TEST:basic\.case_foo!2
-1/8 Test #9: TEST:basic\.case_foo!2 \.+ +Passed +[0-9.]+ sec
- Start 10: TEST:basic\.case_bar!2
-2/8 Test #10: TEST:basic\.case_bar!2 \.+ +Passed +[0-9.]+ sec
- Start 11: TEST:basic\.disabled_case!2
-3/8 Test #11: TEST:basic\.disabled_case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec
- Start 12: TEST:disabled\.case!2
-4/8 Test #12: TEST:disabled\.case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec
- Start 13: TEST:typed/short\.case!2
-5/8 Test #13: TEST:typed/short\.case!2 \.+ +Passed +[0-9.]+ sec
- Start 14: TEST:typed/float\.case!2
-6/8 Test #14: TEST:typed/float\.case!2 \.+ +Passed +[0-9.]+ sec
- Start 15: TEST:value/test\.case/1!2
-7/8 Test #15: TEST:value/test\.case/1!2 \.+ +Passed +[0-9.]+ sec
- Start 16: TEST:value/test\.case/"foo"!2
-8/8 Test #16: TEST:value/test\.case/"foo"!2 \.+ +Passed +[0-9.]+ sec
+ Start 12: TEST:basic\.case_foo!2
+ 1/11 Test #12: TEST:basic\.case_foo!2 \.+ +Passed +[0-9.]+ sec
+ Start 13: TEST:basic\.case_bar!2
+ 2/11 Test #13: TEST:basic\.case_bar!2 \.+ +Passed +[0-9.]+ sec
+ Start 14: TEST:basic\.disabled_case!2
+ 3/11 Test #14: TEST:basic\.disabled_case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec
+ Start 15: TEST:disabled\.case!2
+ 4/11 Test #15: TEST:disabled\.case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec
+ Start 16: TEST:typed/short\.case!2
+ 5/11 Test #16: TEST:typed/short\.case!2 \.+ +Passed +[0-9.]+ sec
+ Start 17: TEST:typed/float\.case!2
+ 6/11 Test #17: TEST:typed/float\.case!2 \.+ +Passed +[0-9.]+ sec
+ Start 18: TEST:value/test\.case/1!2
+ 7/11 Test #18: TEST:value/test\.case/1!2 \.+ +Passed +[0-9.]+ sec
+ Start 19: TEST:value/test\.case/"foo"!2
+ 8/11 Test #19: TEST:value/test\.case/"foo"!2 \.+ +Passed +[0-9.]+ sec
+ Start 20: TEST:param/special\.case/"semicolon;"!2
+ 9/11 Test #20: TEST:param/special\.case/"semicolon;"!2 \.+ +Passed +[0-9.]+ sec
+ Start 21: TEST:param/special\.case/"backslash\\"!2
+10/11 Test #21: TEST:param/special\.case/"backslash\\"!2 \.+ +Passed +[0-9.]+ sec
+ Start 22: TEST:param/special\.case/"\$\{var\}"!2
+11/11 Test #22: TEST:param/special\.case/"\$\{var\}"!2 \.+ +Passed +[0-9.]+ sec
-100% tests passed, 0 tests failed out of 6
+100% tests passed, 0 tests failed out of 9
Total Test time \(real\) = +[0-9.]+ sec
The following tests did not run:
-.*11 - TEST:basic\.disabled_case!2 \(Disabled\)
-.*12 - TEST:disabled\.case!2 \(Disabled\)
+.*14 - TEST:basic\.disabled_case!2 \(Disabled\)
+.*15 - TEST:disabled\.case!2 \(Disabled\)
diff --git a/Tests/RunCMake/GoogleTest/fake_gtest.cpp b/Tests/RunCMake/GoogleTest/fake_gtest.cpp
index f1bd7ef..a8127bf 100644
--- a/Tests/RunCMake/GoogleTest/fake_gtest.cpp
+++ b/Tests/RunCMake/GoogleTest/fake_gtest.cpp
@@ -21,6 +21,10 @@ int main(int argc, char** argv)
std::cout << "value/test." << std::endl;
std::cout << " case/0 # GetParam() = 1" << std::endl;
std::cout << " case/1 # GetParam() = \"foo\"" << std::endl;
+ std::cout << "param/special." << std::endl;
+ std::cout << " case/0 # GetParam() = \"semicolon;\"" << std::endl;
+ std::cout << " case/1 # GetParam() = \"backslash\\\"" << std::endl;
+ std::cout << " case/2 # GetParam() = \"${var}\"" << std::endl;
return 0;
}
diff --git a/Tests/RunCMake/NinjaMultiConfig/Install-all-install-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Install-all-install-ninja-check.cmake
new file mode 100644
index 0000000..c588aac
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/Install-all-install-ninja-check.cmake
@@ -0,0 +1,39 @@
+check_files("${RunCMake_TEST_BINARY_DIR}"
+ INCLUDE
+ ${TARGET_FILE_exe_Debug}
+ ${TARGET_OBJECT_FILES_exe_Debug}
+
+ ${TARGET_FILE_mylib_Release}
+ ${TARGET_LINKER_FILE_mylib_Debug}
+ ${TARGET_OBJECT_FILES_mylib_Debug}
+
+ ${RunCMake_TEST_BINARY_DIR}/install/bin/Debug/${TARGET_FILE_NAME_exe_Debug}
+ ${RunCMake_TEST_BINARY_DIR}/install/lib/Debug/${TARGET_FILE_NAME_mylib_Debug}
+ ${RunCMake_TEST_BINARY_DIR}/install/lib/Debug/${TARGET_LINKER_FILE_NAME_mylib_Debug}
+
+ ${TARGET_FILE_exe_Release}
+ ${TARGET_OBJECT_FILES_exe_Release}
+
+ ${TARGET_FILE_mylib_Release}
+ ${TARGET_LINKER_FILE_mylib_Release}
+ ${TARGET_OBJECT_FILES_mylib_Release}
+
+ ${RunCMake_TEST_BINARY_DIR}/install/bin/Release/${TARGET_FILE_NAME_exe_Release}
+ ${RunCMake_TEST_BINARY_DIR}/install/lib/Release/${TARGET_FILE_NAME_mylib_Release}
+ ${RunCMake_TEST_BINARY_DIR}/install/lib/Release/${TARGET_LINKER_FILE_NAME_mylib_Release}
+
+ ${TARGET_FILE_exe_RelWithDebInfo}
+ ${TARGET_OBJECT_FILES_exe_RelWithDebInfo}
+
+ ${TARGET_FILE_mylib_RelWithDebInfo}
+ ${TARGET_LINKER_FILE_mylib_RelWithDebInfo}
+ ${TARGET_OBJECT_FILES_mylib_RelWithDebInfo}
+
+ ${RunCMake_TEST_BINARY_DIR}/install/bin/RelWithDebInfo/${TARGET_FILE_NAME_exe_RelWithDebInfo}
+ ${RunCMake_TEST_BINARY_DIR}/install/lib/RelWithDebInfo/${TARGET_FILE_NAME_mylib_RelWithDebInfo}
+ ${RunCMake_TEST_BINARY_DIR}/install/lib/RelWithDebInfo/${TARGET_LINKER_FILE_NAME_mylib_RelWithDebInfo}
+
+ EXCLUDE
+ ${TARGET_OBJECT_FILES_exe_MinSizeRel}
+ ${TARGET_OBJECT_FILES_mylib_MinSizeRel}
+ )
diff --git a/Tests/RunCMake/NinjaMultiConfig/Install-default-install-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Install-default-install-ninja-check.cmake
new file mode 100644
index 0000000..bc15a25
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/Install-default-install-ninja-check.cmake
@@ -0,0 +1,31 @@
+check_files("${RunCMake_TEST_BINARY_DIR}"
+ INCLUDE
+ ${TARGET_FILE_exe_Debug}
+ ${TARGET_OBJECT_FILES_exe_Debug}
+
+ ${TARGET_FILE_mylib_Release}
+ ${TARGET_LINKER_FILE_mylib_Debug}
+ ${TARGET_OBJECT_FILES_mylib_Debug}
+
+ ${RunCMake_TEST_BINARY_DIR}/install/bin/Debug/${TARGET_FILE_NAME_exe_Debug}
+ ${RunCMake_TEST_BINARY_DIR}/install/lib/Debug/${TARGET_FILE_NAME_mylib_Debug}
+ ${RunCMake_TEST_BINARY_DIR}/install/lib/Debug/${TARGET_LINKER_FILE_NAME_mylib_Debug}
+
+ ${TARGET_FILE_exe_Release}
+ ${TARGET_OBJECT_FILES_exe_Release}
+
+ ${TARGET_FILE_mylib_Release}
+ ${TARGET_LINKER_FILE_mylib_Release}
+ ${TARGET_OBJECT_FILES_mylib_Release}
+
+ ${RunCMake_TEST_BINARY_DIR}/install/bin/Release/${TARGET_FILE_NAME_exe_Release}
+ ${RunCMake_TEST_BINARY_DIR}/install/lib/Release/${TARGET_FILE_NAME_mylib_Release}
+ ${RunCMake_TEST_BINARY_DIR}/install/lib/Release/${TARGET_LINKER_FILE_NAME_mylib_Release}
+
+ EXCLUDE
+ ${TARGET_OBJECT_FILES_exe_MinSizeRel}
+ ${TARGET_OBJECT_FILES_mylib_MinSizeRel}
+
+ ${TARGET_OBJECT_FILES_exe_RelWithDebInfo}
+ ${TARGET_OBJECT_FILES_mylib_RelWithDebInfo}
+ )
diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
index 6472f46..76b488e 100644
--- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
@@ -263,12 +263,16 @@ run_cmake_build(AdditionalCleanFiles release-clean Release clean)
run_ninja(AdditionalCleanFiles all-clean build-Debug.ninja clean:all)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Install-build)
-set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_TEST_BINARY_DIR}/install;-DCMAKE_CROSS_CONFIGS=all")
+set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_TEST_BINARY_DIR}/install;-DCMAKE_CROSS_CONFIGS=all;-DCMAKE_DEFAULT_CONFIGS=Debug\\;Release")
run_cmake_configure(Install)
unset(RunCMake_TEST_OPTIONS)
include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
run_cmake_build(Install release-install Release install)
run_ninja(Install debug-in-release-graph-install build-Release.ninja install:Debug)
+file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}/install")
+run_ninja(Install default-install build.ninja install)
+file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}/install")
+run_ninja(Install all-install build.ninja install:all)
# FIXME Get this working
#set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AutoMocExecutable-build)
@@ -285,7 +289,8 @@ run_cmake_command(NoUnusedVariables ${CMAKE_COMMAND} ${CMAKE_CURRENT_LIST_DIR}
"-DCMAKE_DEFAULT_CONFIGS=all"
)
-if(CMake_TEST_CUDA)
+# CudaSimple uses separable compilation, which is currently only supported on NVCC.
+if(CMake_TEST_CUDA AND NOT CMake_TEST_CUDA STREQUAL "Clang")
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CudaSimple-build)
run_cmake_configure(CudaSimple)
include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
diff --git a/Tests/RunCMake/ObjectLibrary/b.c b/Tests/RunCMake/ObjectLibrary/b.c
index 220ce03..2c65a2b 100644
--- a/Tests/RunCMake/ObjectLibrary/b.c
+++ b/Tests/RunCMake/ObjectLibrary/b.c
@@ -5,7 +5,7 @@
#endif
extern int a(void);
-EXPORT int b()
+EXPORT int b(void)
{
return a();
}
diff --git a/Tests/RunCMake/ObjectLibrary/requires.c b/Tests/RunCMake/ObjectLibrary/requires.c
index 685632b..a5b429a 100644
--- a/Tests/RunCMake/ObjectLibrary/requires.c
+++ b/Tests/RunCMake/ObjectLibrary/requires.c
@@ -1,5 +1,5 @@
#ifdef REQUIRED
-int required()
+int required(void)
{
return 0;
}
diff --git a/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake b/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake
index a1e0792..aab20d8 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake
@@ -9,6 +9,9 @@ target_precompile_headers(foo PUBLIC
<stdio.h>
\"string.h\"
)
+if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
+ set_property(SOURCE foo.c APPEND PROPERTY COMPILE_OPTIONS "-WX-")
+endif()
add_library(bar INTERFACE)
target_include_directories(bar INTERFACE include)
diff --git a/Tests/RunCMake/PrecompileHeaders/empty.c b/Tests/RunCMake/PrecompileHeaders/empty.c
index 30ae1c4..2a51ebc 100644
--- a/Tests/RunCMake/PrecompileHeaders/empty.c
+++ b/Tests/RunCMake/PrecompileHeaders/empty.c
@@ -1,3 +1,3 @@
-void nothing()
+void nothing(void)
{
}
diff --git a/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake b/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake
index 24daa64..9ba3c85 100644
--- a/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake
+++ b/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake
@@ -1,14 +1,20 @@
include(RunCMake)
run_cmake(unitybuild_c)
+run_cmake(unitybuild_c_batch)
+run_cmake(unitybuild_c_group)
run_cmake(unitybuild_cxx)
+run_cmake(unitybuild_cxx_group)
run_cmake(unitybuild_c_and_cxx)
+run_cmake(unitybuild_c_and_cxx_group)
run_cmake(unitybuild_batchsize)
run_cmake(unitybuild_default_batchsize)
run_cmake(unitybuild_skip)
run_cmake(unitybuild_code_before_and_after_include)
run_cmake(unitybuild_c_no_unity_build)
+run_cmake(unitybuild_c_no_unity_build_group)
run_cmake(unitybuild_order)
+run_cmake(unitybuild_invalid_mode)
function(run_test name)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build)
diff --git a/Tests/RunCMake/UnityBuild/f.c b/Tests/RunCMake/UnityBuild/f.c
new file mode 100644
index 0000000..d5813c6
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/f.c
@@ -0,0 +1,5 @@
+int f(int x)
+{
+ (void)x;
+ return 0;
+}
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_group-check.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_group-check.cmake
new file mode 100644
index 0000000..b027682
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_group-check.cmake
@@ -0,0 +1,42 @@
+set(unitybuild_a_c "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_a_c.c")
+if(NOT EXISTS "${unitybuild_a_c}")
+ set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_a_c} does not exist.")
+ return()
+else()
+ #verify that the 4 c file is part of this grouping and therefore UNITY_BUILD_BATCH_SIZE
+ #was ignored
+ file(STRINGS ${unitybuild_a_c} unitybuild_a_c_strings)
+ string(REGEX MATCH ".*#include.*s1.c.*#include.*s2.c.*#include.*s3.c.*#include.*s4.c.*" matched_code ${unitybuild_a_c_strings})
+ if(NOT matched_code)
+ set(RunCMake_TEST_FAILED "Generated unity file doesn't include expected source files")
+ return()
+ endif()
+endif()
+
+set(unitybuild_b_c "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_b_c.c")
+if(NOT EXISTS "${unitybuild_b_c}")
+ set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_b_c} does not exist.")
+ return()
+endif()
+
+
+set(unitybuild_a_cxx "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_a_cxx.cxx")
+if(NOT EXISTS "${unitybuild_a_cxx}")
+ set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_a_cxx} does not exist.")
+ return()
+else()
+ #verify that the 4 cxx file are part of this grouping and therefore UNITY_BUILD_BATCH_SIZE
+ #was ignored
+ file(STRINGS ${unitybuild_a_cxx} unitybuild_a_cxx_strings)
+ string(REGEX MATCH ".*#include.*s1.cxx.*#include.*s2.cxx.*#include.*s3.cxx.*#include.*s4.cxx.*" matched_code ${unitybuild_a_cxx_strings})
+ if(NOT matched_code)
+ set(RunCMake_TEST_FAILED "Generated unity file doesn't include expected source files")
+ return()
+ endif()
+endif()
+
+set(unitybuild_b_cxx "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_b_cxx.cxx")
+if(NOT EXISTS "${unitybuild_b_cxx}")
+ set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_b_cxx} does not exist.")
+ return()
+endif()
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_group.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_group.cmake
new file mode 100644
index 0000000..7bf3f4b
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_group.cmake
@@ -0,0 +1,39 @@
+project(unitybuild_c_and_cxx C CXX)
+
+set(srcs f.c)
+foreach(s RANGE 1 8)
+ set(src_c "${CMAKE_CURRENT_BINARY_DIR}/s${s}.c")
+ file(WRITE "${src_c}" "
+int f(int);\n
+int s${s}(void) { return f(${s}); }\n"
+ )
+
+ set(src_cxx "${CMAKE_CURRENT_BINARY_DIR}/s${s}.cxx")
+ file(WRITE "${src_cxx}" "
+extern \"C\" { \n
+ int f(int); \n
+}\n
+ int s${s}(void) { return f(${s}); }\n"
+ )
+
+ list(APPEND srcs "${src_c}")
+ list(APPEND srcs "${src_cxx}")
+endforeach()
+
+
+
+add_library(tgt SHARED ${srcs})
+
+set_target_properties(tgt PROPERTIES UNITY_BUILD ON
+ UNITY_BUILD_MODE GROUP
+ #UNITY_BUILD_BATCH_SIZE will be ignored
+ UNITY_BUILD_BATCH_SIZE 2)
+
+set_source_files_properties(s1.c s2.c s3.c s4.c
+ s1.cxx s2.cxx s3.cxx s4.cxx
+ PROPERTIES UNITY_GROUP "a"
+ )
+set_source_files_properties(s5.c s6.c s7.c s8.c
+ s5.cxx s6.cxx s7.cxx s8.cxx
+ PROPERTIES UNITY_GROUP "b"
+ )
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_batch-check.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_batch-check.cmake
new file mode 100644
index 0000000..024286d
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_c_batch-check.cmake
@@ -0,0 +1,5 @@
+set(unitybuild_c "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_0_c.c")
+if(NOT EXISTS "${unitybuild_c}")
+ set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_c} does not exist.")
+ return()
+endif()
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_batch.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_batch.cmake
new file mode 100644
index 0000000..33873b6
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_c_batch.cmake
@@ -0,0 +1,15 @@
+project(unitybuild_c C)
+
+set(srcs "")
+foreach(s RANGE 1 8)
+ set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.c")
+ file(WRITE "${src}" "int s${s}(void) { return 0; }\n")
+ list(APPEND srcs "${src}")
+endforeach()
+
+add_library(tgt SHARED ${srcs})
+
+set_target_properties(tgt PROPERTIES
+ UNITY_BUILD ON
+ UNITY_BUILD_MODE BATCH
+ )
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_group-check.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_group-check.cmake
new file mode 100644
index 0000000..0b9ea15
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_c_group-check.cmake
@@ -0,0 +1,11 @@
+set(unitybuild_a_c "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_a_c.c")
+if(NOT EXISTS "${unitybuild_a_c}")
+ set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_a_c} does not exist.")
+ return()
+endif()
+
+set(unitybuild_b_c "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_b_c.c")
+if(NOT EXISTS "${unitybuild_b_c}")
+ set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_b_c} does not exist.")
+ return()
+endif()
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_group.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_group.cmake
new file mode 100644
index 0000000..1fa17f3
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_c_group.cmake
@@ -0,0 +1,17 @@
+project(unitybuild_c C)
+
+set(srcs "")
+foreach(s RANGE 1 8)
+ set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.c")
+ file(WRITE "${src}" "int s${s}(void) { return 0; }\n")
+ list(APPEND srcs "${src}")
+endforeach()
+
+add_library(tgt SHARED ${srcs})
+
+set_target_properties(tgt PROPERTIES UNITY_BUILD ON
+ UNITY_BUILD_MODE GROUP)
+
+set_source_files_properties(s1.c PROPERTIES UNITY_GROUP "a")
+set_source_files_properties(s2.c PROPERTIES UNITY_GROUP "a")
+set_source_files_properties(s3.c s4.c PROPERTIES UNITY_GROUP "b")
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_no_unity_build_group-check.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_no_unity_build_group-check.cmake
new file mode 100644
index 0000000..e344627
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_c_no_unity_build_group-check.cmake
@@ -0,0 +1,5 @@
+set(unitybuild_c "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_a_c.c")
+if(EXISTS "${unitybuild_c}")
+ set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_c} should not exist.")
+ return()
+endif()
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_no_unity_build_group.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_no_unity_build_group.cmake
new file mode 100644
index 0000000..7b26dc1
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_c_no_unity_build_group.cmake
@@ -0,0 +1,16 @@
+project(unitybuild_c_no_unity_build C)
+
+set(srcs "")
+foreach(s RANGE 1 8)
+ set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.c")
+ file(WRITE "${src}" "int s${s}(void) { return 0; }\n")
+ list(APPEND srcs "${src}")
+endforeach()
+
+add_library(tgt SHARED ${srcs})
+
+#These should be ignored as UNITY_BUILD is off
+set_target_properties(tgt PROPERTIES UNITY_BUILD_MODE GROUP)
+set_source_files_properties(s1.c s2.c s3.c s4.c s5.c s6.c s7.c s8.c
+ PROPERTIES UNITY_GROUP "a"
+ )
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_cxx_group-check.cmake b/Tests/RunCMake/UnityBuild/unitybuild_cxx_group-check.cmake
new file mode 100644
index 0000000..ecef3a3
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_cxx_group-check.cmake
@@ -0,0 +1,27 @@
+set(unitybuild_a_cxx "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_a_cxx.cxx")
+if(NOT EXISTS "${unitybuild_a_cxx}")
+ set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_a_cxx} does not exist.")
+ return()
+else()
+ #verify that odr2 is not part of this source set
+ file(STRINGS ${unitybuild_a_cxx} unitybuild_a_cxx_strings)
+ string(REGEX MATCH ".*#include.*odr2.cxx" matched_code ${unitybuild_a_cxx_strings})
+ if(matched_code)
+ set(RunCMake_TEST_FAILED "Generated unity file includes un-expected ord2.cxx source file")
+ return()
+ endif()
+endif()
+
+set(unitybuild_b_cxx "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_b_cxx.cxx")
+if(NOT EXISTS "${unitybuild_b_cxx}")
+ set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_b_cxx} does not exist.")
+ return()
+else()
+ #verify that odr1 is not part of this source set
+ file(STRINGS ${unitybuild_b_cxx} unitybuild_b_cxx_strings)
+ string(REGEX MATCH ".*#include.*odr1.cxx" matched_code ${unitybuild_b_cxx_strings})
+ if(matched_code)
+ set(RunCMake_TEST_FAILED "Generated unity file includes un-expected ord1.cxx source file")
+ return()
+ endif()
+endif()
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_cxx_group.cmake b/Tests/RunCMake/UnityBuild/unitybuild_cxx_group.cmake
new file mode 100644
index 0000000..9804289
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_cxx_group.cmake
@@ -0,0 +1,27 @@
+project(unitybuild_cxx CXX)
+
+set(srcs "")
+foreach(s RANGE 1 4)
+ set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.cxx")
+ file(WRITE "${src}" "int s${s}(void) { return 0; }\n")
+ list(APPEND srcs "${src}")
+endforeach()
+
+foreach(s RANGE 1 2)
+ set(src "${CMAKE_CURRENT_BINARY_DIR}/odr${s}.cxx")
+ file(WRITE "${src}" "namespace odr { int s${s}(void) { return 0; } }\n")
+ list(APPEND srcs "${src}")
+endforeach()
+
+add_library(tgt SHARED ${srcs})
+
+set_target_properties(tgt PROPERTIES UNITY_BUILD ON
+ UNITY_BUILD_MODE GROUP
+ )
+
+set_source_files_properties(s1.cxx s2.cxx odr1.cxx
+ PROPERTIES UNITY_GROUP "a"
+ )
+set_source_files_properties(s3.cxx s4.cxx odr2.cxx
+ PROPERTIES UNITY_GROUP "b"
+ )
diff --git a/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation-result.txt b/Tests/RunCMake/UnityBuild/unitybuild_invalid_mode-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation-result.txt
+++ b/Tests/RunCMake/UnityBuild/unitybuild_invalid_mode-result.txt
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_invalid_mode-stderr.txt b/Tests/RunCMake/UnityBuild/unitybuild_invalid_mode-stderr.txt
new file mode 100644
index 0000000..b1b17a0
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_invalid_mode-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error in CMakeLists.txt:
+ Invalid UNITY_BUILD_MODE value of INVALID assigned to target tgt\.
+ Acceptable values are BATCH and GROUP\.
+.*
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/UnityBuild/unitybuild_invalid_mode.cmake b/Tests/RunCMake/UnityBuild/unitybuild_invalid_mode.cmake
new file mode 100644
index 0000000..0212200
--- /dev/null
+++ b/Tests/RunCMake/UnityBuild/unitybuild_invalid_mode.cmake
@@ -0,0 +1,12 @@
+project(unitybuild_c C)
+
+set(srcs "")
+foreach(s RANGE 1 8)
+ set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.c")
+ file(WRITE "${src}" "int s${s}(void) { return 0; }\n")
+ list(APPEND srcs "${src}")
+endforeach()
+
+add_library(tgt SHARED ${srcs})
+
+set_target_properties(tgt PROPERTIES UNITY_BUILD ON UNITY_BUILD_MODE INVALID)
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
index 06ccaae..93ef603 100644
--- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
@@ -56,6 +56,7 @@ if (RunCMake_GENERATOR MATCHES "Visual Studio 1[0-4] 201[0-5]" OR
run_cmake(UnityBuildPre2017)
else()
run_cmake(UnityBuildNative)
+ run_cmake(UnityBuildNativeGrouped)
endif()
run_cmake(VsDotnetTargetFramework)
diff --git a/Tests/RunCMake/VS10Project/UnityBuildNativeGrouped-check.cmake b/Tests/RunCMake/VS10Project/UnityBuildNativeGrouped-check.cmake
new file mode 100644
index 0000000..d6380da
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/UnityBuildNativeGrouped-check.cmake
@@ -0,0 +1,56 @@
+set(unitybuild_c0 "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_poolA_c.c")
+if(NOT EXISTS "${unitybuild_c0}")
+ set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_c0} does not exist.")
+ return()
+endif()
+
+set(unitybuild_c1 "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_poolB_c.c")
+if(NOT EXISTS "${unitybuild_c1}")
+ set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_c1} does not exist.")
+ return()
+endif()
+
+set(tgt_project "${RunCMake_TEST_BINARY_DIR}/tgt.vcxproj")
+if (NOT EXISTS "${tgt_project}")
+ set(RunCMake_TEST_FAILED "Generated project file ${tgt_project} doesn't exist.")
+ return()
+endif()
+
+file(STRINGS ${tgt_project} tgt_projects_strings)
+
+foreach(line IN LISTS tgt_projects_strings)
+ if (line MATCHES "<EnableUnitySupport>true</EnableUnitySupport>")
+ set(have_unity_support ON)
+ endif()
+
+ if (line MATCHES "<ClCompile Include=.*IncludeInUnityFile=\"false\" CustomUnityFile=\"true\"")
+ list(APPEND unity_source_lines ${line})
+ endif()
+
+ if (line MATCHES "<ClCompile Include=.*IncludeInUnityFile=\"true\" CustomUnityFile=\"true\"")
+ list(APPEND sources_list ${line})
+ endif()
+endforeach()
+
+if (NOT have_unity_support)
+ set(RunCMake_TEST_FAILED "Generated project should include the <EnableUnitySupport> block.")
+ return()
+endif()
+
+string(REPLACE "\\" "/" unity_source_lines "${unity_source_lines}")
+string(FIND "${unity_source_lines}" "CMakeFiles/tgt.dir/Unity/unity_poolA_c.c" unity_source_file_position)
+if (unity_source_file_position EQUAL "-1")
+ set(RunCMake_TEST_FAILED "Generated project should include the generated unity source file 'poolA'.")
+ return()
+endif()
+string(FIND "${unity_source_lines}" "CMakeFiles/tgt.dir/Unity/unity_poolB_c.c" unity_source_file_position)
+if (unity_source_file_position EQUAL "-1")
+ set(RunCMake_TEST_FAILED "Generated project should include the generated unity source file 'poolB'.")
+ return()
+endif()
+
+list(LENGTH sources_list number_of_sources)
+if(NOT number_of_sources EQUAL 7)
+ set(RunCMake_TEST_FAILED "Generated project doesn't include the expect number of files.")
+ return()
+endif()
diff --git a/Tests/RunCMake/VS10Project/UnityBuildNativeGrouped.cmake b/Tests/RunCMake/VS10Project/UnityBuildNativeGrouped.cmake
new file mode 100644
index 0000000..b740e3b
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/UnityBuildNativeGrouped.cmake
@@ -0,0 +1,20 @@
+project(unitybuild_c C)
+
+set(srcs "")
+foreach(s RANGE 1 8)
+ set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.c")
+ file(WRITE "${src}" "int s${s}(void) { return 0; }\n")
+ list(APPEND srcs "${src}")
+endforeach()
+
+add_library(tgt SHARED ${srcs})
+
+set_target_properties(tgt PROPERTIES UNITY_BUILD ON UNITY_BUILD_MODE GROUP)
+
+set_source_files_properties(s1.c s2.c s3.c s4.c
+ PROPERTIES UNITY_GROUP "poolA"
+ )
+
+set_source_files_properties(s5.c s6.c s7.c
+ PROPERTIES UNITY_GROUP "poolB"
+ )
diff --git a/Tests/RunCMake/VS10Project/UnityBuildPre2017Grouped-check.cmake b/Tests/RunCMake/VS10Project/UnityBuildPre2017Grouped-check.cmake
new file mode 100644
index 0000000..d9b8c01
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/UnityBuildPre2017Grouped-check.cmake
@@ -0,0 +1,59 @@
+set(unitybuild_c0 "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_poolA.c")
+if(NOT EXISTS "${unitybuild_c0}")
+ set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_c0} does not exist.")
+ return()
+endif()
+
+set(unitybuild_c1 "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_poolB.c")
+if(NOT EXISTS "${unitybuild_c1}")
+ set(RunCMake_TEST_FAILED "Generated unity source files ${unitybuild_c1} does not exist.")
+ return()
+endif()
+
+set(tgt_project "${RunCMake_TEST_BINARY_DIR}/tgt.vcxproj")
+if (NOT EXISTS "${tgt_project}")
+ set(RunCMake_TEST_FAILED "Generated project file ${tgt_project} doesn't exist.")
+ return()
+endif()
+
+file(STRINGS ${tgt_project} tgt_projects_strings)
+
+foreach(line IN LISTS tgt_projects_strings)
+ if (line MATCHES "<ClCompile Include=.*/>")
+ set(unity_source_line ${line})
+ endif()
+
+ if (line MATCHES "<ClCompile Include=\"[^\"]*\">")
+ string(REGEX MATCH "<ClCompile Include=\"([^\"]*)\">" source_file ${line})
+ list(APPEND sources_list ${source_file})
+ endif()
+
+ if (line MATCHES "<ExcludedFromBuild.*</ExcludedFromBuild>")
+ list(APPEND excluded_sources_list ${source_file})
+ endif()
+endforeach()
+
+string(REPLACE "\\" "/" unity_source_line ${unity_source_line})
+string(FIND "${unity_source_line}" "CMakeFiles/tgt.dir/Unity/unity_poolA.c" unity_source_file_position)
+if (unity_source_file_position EQUAL "-1")
+ set(RunCMake_TEST_FAILED "Generated project should include the generated unity source file.")
+ return()
+endif()
+string(FIND "${unity_source_line}" "CMakeFiles/tgt.dir/Unity/unity_poolB.c" unity_source_file_position)
+if (unity_source_file_position EQUAL "-1")
+ set(RunCMake_TEST_FAILED "Generated project should include the generated unity source file.")
+ return()
+endif()
+
+list(LENGTH sources_list number_of_sources)
+if(NOT number_of_sources EQUAL 7)
+ set(RunCMake_TEST_FAILED "Generated project doesn't include the expect number of files.")
+ return()
+endif()
+
+# Exclusions for Debug|Release|MinSizeRel|RelWithDebInfo
+list(LENGTH excluded_sources_list number_of_excluded_sources)
+if(NOT number_of_excluded_sources EQUAL 28)
+ set(RunCMake_TEST_FAILED "Generated project doesn't exclude the source files for all configurations.")
+ return()
+endif()
diff --git a/Tests/RunCMake/VS10Project/UnityBuildPre2017Grouped.cmake b/Tests/RunCMake/VS10Project/UnityBuildPre2017Grouped.cmake
new file mode 100644
index 0000000..b740e3b
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/UnityBuildPre2017Grouped.cmake
@@ -0,0 +1,20 @@
+project(unitybuild_c C)
+
+set(srcs "")
+foreach(s RANGE 1 8)
+ set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.c")
+ file(WRITE "${src}" "int s${s}(void) { return 0; }\n")
+ list(APPEND srcs "${src}")
+endforeach()
+
+add_library(tgt SHARED ${srcs})
+
+set_target_properties(tgt PROPERTIES UNITY_BUILD ON UNITY_BUILD_MODE GROUP)
+
+set_source_files_properties(s1.c s2.c s3.c s4.c
+ PROPERTIES UNITY_GROUP "poolA"
+ )
+
+set_source_files_properties(s5.c s6.c s7.c
+ PROPERTIES UNITY_GROUP "poolB"
+ )
diff --git a/Tests/RunCMake/add_test/CMakeLists.txt.in b/Tests/RunCMake/add_test/CMakeLists.txt.in
new file mode 100644
index 0000000..495240d
--- /dev/null
+++ b/Tests/RunCMake/add_test/CMakeLists.txt.in
@@ -0,0 +1,27 @@
+if (NOT DEFINED RUN_AS_SCRIPT)
+
+ cmake_minimum_required(VERSION 3.7)
+ project(@CASE_NAME@ NONE)
+ include(CTest)
+
+ # Two fallback tests for set_tests_properties.
+ add_test(NAME PrefixTest COMMAND "${CMAKE_COMMAND}" --version)
+ add_test(NAME SuffixTest COMMAND "${CMAKE_COMMAND}" --version)
+
+ add_test(
+ NAME @CASE_CMAKELISTS_NAME_1@
+ COMMAND "${CMAKE_COMMAND}" -D RUN_AS_SCRIPT=1 -P "${CMAKE_CURRENT_LIST_FILE}"
+ )
+ set_tests_properties(
+ @CASE_CMAKELISTS_NAME_2@
+ PROPERTIES
+ ENVIRONMENT CMAKE_add_test_ENVVAR=1
+ )
+
+else()
+
+ if(NOT DEFINED ENV{CMAKE_add_test_ENVVAR})
+ message(FATAL_ERROR "Setting property on test did not succeed!")
+ endif()
+
+endif()
diff --git a/Tests/RunCMake/add_test/NameContainsBracketArgument1-stdout.txt b/Tests/RunCMake/add_test/NameContainsBracketArgument1-stdout.txt
new file mode 100644
index 0000000..00865d0
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsBracketArgument1-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: \[=\[BracketArgument;SuffixTest\]=\] \.+[ ]+Passed
diff --git a/Tests/RunCMake/add_test/NameContainsBracketArgument2-stdout.txt b/Tests/RunCMake/add_test/NameContainsBracketArgument2-stdout.txt
new file mode 100644
index 0000000..a744beb
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsBracketArgument2-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: BracketArgument;SuffixTest \.+[ ]+Passed
diff --git a/Tests/RunCMake/add_test/NameContainsBracketArgument3-result.txt b/Tests/RunCMake/add_test/NameContainsBracketArgument3-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsBracketArgument3-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/add_test/NameContainsBracketArgument3-stderr.txt b/Tests/RunCMake/add_test/NameContainsBracketArgument3-stderr.txt
new file mode 100644
index 0000000..32c2112
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsBracketArgument3-stderr.txt
@@ -0,0 +1,2 @@
+Error\(s\) when configuring the project
+No tests were found!!!
diff --git a/Tests/RunCMake/add_test/NameContainsBracketArgument4-result.txt b/Tests/RunCMake/add_test/NameContainsBracketArgument4-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsBracketArgument4-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/add_test/NameContainsBracketArgument4-stderr.txt b/Tests/RunCMake/add_test/NameContainsBracketArgument4-stderr.txt
new file mode 100644
index 0000000..32c2112
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsBracketArgument4-stderr.txt
@@ -0,0 +1,2 @@
+Error\(s\) when configuring the project
+No tests were found!!!
diff --git a/Tests/RunCMake/add_test/NameContainsEscapedQuote1-result.txt b/Tests/RunCMake/add_test/NameContainsEscapedQuote1-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsEscapedQuote1-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/add_test/NameContainsEscapedQuote1-stderr.txt b/Tests/RunCMake/add_test/NameContainsEscapedQuote1-stderr.txt
new file mode 100644
index 0000000..0661945
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsEscapedQuote1-stderr.txt
@@ -0,0 +1 @@
+Unable to find executable: SuffixTest
diff --git a/Tests/RunCMake/add_test/NameContainsEscapedQuote1-stdout.txt b/Tests/RunCMake/add_test/NameContainsEscapedQuote1-stdout.txt
new file mode 100644
index 0000000..4875409
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsEscapedQuote1-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: EscapedQuote \.+\*\*\*Not Run
diff --git a/Tests/RunCMake/add_test/NameContainsEscapedQuote2-result.txt b/Tests/RunCMake/add_test/NameContainsEscapedQuote2-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsEscapedQuote2-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/add_test/NameContainsEscapedQuote2-stderr.txt b/Tests/RunCMake/add_test/NameContainsEscapedQuote2-stderr.txt
new file mode 100644
index 0000000..0661945
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsEscapedQuote2-stderr.txt
@@ -0,0 +1 @@
+Unable to find executable: SuffixTest
diff --git a/Tests/RunCMake/add_test/NameContainsEscapedQuote2-stdout.txt b/Tests/RunCMake/add_test/NameContainsEscapedQuote2-stdout.txt
new file mode 100644
index 0000000..4875409
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsEscapedQuote2-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: EscapedQuote \.+\*\*\*Not Run
diff --git a/Tests/RunCMake/add_test/NameContainsEscapedQuote3-result.txt b/Tests/RunCMake/add_test/NameContainsEscapedQuote3-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsEscapedQuote3-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/add_test/NameContainsEscapedQuote3-stderr.txt b/Tests/RunCMake/add_test/NameContainsEscapedQuote3-stderr.txt
new file mode 100644
index 0000000..0661945
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsEscapedQuote3-stderr.txt
@@ -0,0 +1 @@
+Unable to find executable: SuffixTest
diff --git a/Tests/RunCMake/add_test/NameContainsEscapedQuote3-stdout.txt b/Tests/RunCMake/add_test/NameContainsEscapedQuote3-stdout.txt
new file mode 100644
index 0000000..4875409
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsEscapedQuote3-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: EscapedQuote \.+\*\*\*Not Run
diff --git a/Tests/RunCMake/add_test/NameContainsEscapedQuote4-result.txt b/Tests/RunCMake/add_test/NameContainsEscapedQuote4-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsEscapedQuote4-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/add_test/NameContainsEscapedQuote4-stderr.txt b/Tests/RunCMake/add_test/NameContainsEscapedQuote4-stderr.txt
new file mode 100644
index 0000000..0661945
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsEscapedQuote4-stderr.txt
@@ -0,0 +1 @@
+Unable to find executable: SuffixTest
diff --git a/Tests/RunCMake/add_test/NameContainsEscapedQuote4-stdout.txt b/Tests/RunCMake/add_test/NameContainsEscapedQuote4-stdout.txt
new file mode 100644
index 0000000..4875409
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsEscapedQuote4-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: EscapedQuote \.+\*\*\*Not Run
diff --git a/Tests/RunCMake/add_test/NameContainsEscapedSpecialChars1-stdout.txt b/Tests/RunCMake/add_test/NameContainsEscapedSpecialChars1-stdout.txt
new file mode 100644
index 0000000..80435b6
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsEscapedSpecialChars1-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: \(\) # \.+[ ]*Passed
diff --git a/Tests/RunCMake/add_test/NameContainsEscapedSpecialChars2-stdout.txt b/Tests/RunCMake/add_test/NameContainsEscapedSpecialChars2-stdout.txt
new file mode 100644
index 0000000..80435b6
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsEscapedSpecialChars2-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: \(\) # \.+[ ]*Passed
diff --git a/Tests/RunCMake/add_test/NameContainsEscapedSpecialChars3-stdout.txt b/Tests/RunCMake/add_test/NameContainsEscapedSpecialChars3-stdout.txt
new file mode 100644
index 0000000..80435b6
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsEscapedSpecialChars3-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: \(\) # \.+[ ]*Passed
diff --git a/Tests/RunCMake/add_test/NameContainsEscapedSpecialChars4-stdout.txt b/Tests/RunCMake/add_test/NameContainsEscapedSpecialChars4-stdout.txt
new file mode 100644
index 0000000..80435b6
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsEscapedSpecialChars4-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: \(\) # \.+[ ]*Passed
diff --git a/Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax1-stdout.txt b/Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax1-stdout.txt
new file mode 100644
index 0000000..172ff99
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax1-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: \$<BOOL:0> \.+[ ]*Passed
diff --git a/Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax2-stdout.txt b/Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax2-stdout.txt
new file mode 100644
index 0000000..172ff99
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax2-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: \$<BOOL:0> \.+[ ]*Passed
diff --git a/Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax3-stdout.txt b/Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax3-stdout.txt
new file mode 100644
index 0000000..172ff99
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax3-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: \$<BOOL:0> \.+[ ]*Passed
diff --git a/Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax4-stdout.txt b/Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax4-stdout.txt
new file mode 100644
index 0000000..172ff99
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsGeneratorExpressionSyntax4-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: \$<BOOL:0> \.+[ ]*Passed
diff --git a/Tests/RunCMake/add_test/NameContainsOtherSpecialChars1-stdout.txt b/Tests/RunCMake/add_test/NameContainsOtherSpecialChars1-stdout.txt
new file mode 100644
index 0000000..83e3f86
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsOtherSpecialChars1-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: !§\$%&/ü:\*😤~ \.+[ ]*Passed
diff --git a/Tests/RunCMake/add_test/NameContainsOtherSpecialChars2-stdout.txt b/Tests/RunCMake/add_test/NameContainsOtherSpecialChars2-stdout.txt
new file mode 100644
index 0000000..83e3f86
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsOtherSpecialChars2-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: !§\$%&/ü:\*😤~ \.+[ ]*Passed
diff --git a/Tests/RunCMake/add_test/NameContainsOtherSpecialChars3-stdout.txt b/Tests/RunCMake/add_test/NameContainsOtherSpecialChars3-stdout.txt
new file mode 100644
index 0000000..83e3f86
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsOtherSpecialChars3-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: !§\$%&/ü:\*😤~ \.+[ ]*Passed
diff --git a/Tests/RunCMake/add_test/NameContainsOtherSpecialChars4-stdout.txt b/Tests/RunCMake/add_test/NameContainsOtherSpecialChars4-stdout.txt
new file mode 100644
index 0000000..83e3f86
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsOtherSpecialChars4-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: !§\$%&/ü:\*😤~ \.+[ ]*Passed
diff --git a/Tests/RunCMake/add_test/NameContainsSemicolon1-stdout.txt b/Tests/RunCMake/add_test/NameContainsSemicolon1-stdout.txt
new file mode 100644
index 0000000..0fbf486
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsSemicolon1-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: PrefixTest;SuffixTest \.+[ ]*Passed
diff --git a/Tests/RunCMake/add_test/NameContainsSemicolon2-result.txt b/Tests/RunCMake/add_test/NameContainsSemicolon2-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsSemicolon2-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/add_test/NameContainsSemicolon2-stderr.txt b/Tests/RunCMake/add_test/NameContainsSemicolon2-stderr.txt
new file mode 100644
index 0000000..32c2112
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsSemicolon2-stderr.txt
@@ -0,0 +1,2 @@
+Error\(s\) when configuring the project
+No tests were found!!!
diff --git a/Tests/RunCMake/add_test/NameContainsSemicolon3-stdout.txt b/Tests/RunCMake/add_test/NameContainsSemicolon3-stdout.txt
new file mode 100644
index 0000000..c5ab1d8
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsSemicolon3-stdout.txt
@@ -0,0 +1,3 @@
+3/3 Test #3: PrefixTest;SuffixTest \.+\*\*\*Failed.*
+CMake Error at .+/CMakeLists.txt:[0-9]+ \(message\):
+[ ]*Setting property on test did not succeed!
diff --git a/Tests/RunCMake/add_test/NameContainsSemicolon4-result.txt b/Tests/RunCMake/add_test/NameContainsSemicolon4-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsSemicolon4-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/add_test/NameContainsSemicolon4-stderr.txt b/Tests/RunCMake/add_test/NameContainsSemicolon4-stderr.txt
new file mode 100644
index 0000000..32c2112
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsSemicolon4-stderr.txt
@@ -0,0 +1,2 @@
+Error\(s\) when configuring the project
+No tests were found!!!
diff --git a/Tests/RunCMake/add_test/NameContainsSpaces1-stdout.txt b/Tests/RunCMake/add_test/NameContainsSpaces1-stdout.txt
new file mode 100644
index 0000000..a255fb1
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsSpaces1-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: PrefixTest SuffixTest \.+[ ]*Passed
diff --git a/Tests/RunCMake/add_test/NameContainsSpaces2-result.txt b/Tests/RunCMake/add_test/NameContainsSpaces2-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsSpaces2-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/add_test/NameContainsSpaces2-stderr.txt b/Tests/RunCMake/add_test/NameContainsSpaces2-stderr.txt
new file mode 100644
index 0000000..32c2112
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsSpaces2-stderr.txt
@@ -0,0 +1,2 @@
+Error\(s\) when configuring the project
+No tests were found!!!
diff --git a/Tests/RunCMake/add_test/NameContainsSpaces3-stdout.txt b/Tests/RunCMake/add_test/NameContainsSpaces3-stdout.txt
new file mode 100644
index 0000000..3d42b0b
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsSpaces3-stdout.txt
@@ -0,0 +1,3 @@
+3/3 Test #3: PrefixTest SuffixTest \.+\*\*\*Failed.*
+CMake Error at .+/CMakeLists.txt:[0-9]+ \(message\):
+[ ]*Setting property on test did not succeed!
diff --git a/Tests/RunCMake/add_test/NameContainsSpaces4-result.txt b/Tests/RunCMake/add_test/NameContainsSpaces4-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsSpaces4-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/add_test/NameContainsSpaces4-stderr.txt b/Tests/RunCMake/add_test/NameContainsSpaces4-stderr.txt
new file mode 100644
index 0000000..32c2112
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsSpaces4-stderr.txt
@@ -0,0 +1,2 @@
+Error\(s\) when configuring the project
+No tests were found!!!
diff --git a/Tests/RunCMake/add_test/NameContainsValidSpecialChars1-stdout.txt b/Tests/RunCMake/add_test/NameContainsValidSpecialChars1-stdout.txt
new file mode 100644
index 0000000..ae1a0b1
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsValidSpecialChars1-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed
diff --git a/Tests/RunCMake/add_test/NameContainsValidSpecialChars2-stdout.txt b/Tests/RunCMake/add_test/NameContainsValidSpecialChars2-stdout.txt
new file mode 100644
index 0000000..ae1a0b1
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsValidSpecialChars2-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed
diff --git a/Tests/RunCMake/add_test/NameContainsValidSpecialChars3-stdout.txt b/Tests/RunCMake/add_test/NameContainsValidSpecialChars3-stdout.txt
new file mode 100644
index 0000000..ae1a0b1
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsValidSpecialChars3-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed
diff --git a/Tests/RunCMake/add_test/NameContainsValidSpecialChars4-stdout.txt b/Tests/RunCMake/add_test/NameContainsValidSpecialChars4-stdout.txt
new file mode 100644
index 0000000..ae1a0b1
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameContainsValidSpecialChars4-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed
diff --git a/Tests/RunCMake/add_test/NameIsAlphaNumeric1-stdout.txt b/Tests/RunCMake/add_test/NameIsAlphaNumeric1-stdout.txt
new file mode 100644
index 0000000..ed939bf
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameIsAlphaNumeric1-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed
diff --git a/Tests/RunCMake/add_test/NameIsAlphaNumeric2-stdout.txt b/Tests/RunCMake/add_test/NameIsAlphaNumeric2-stdout.txt
new file mode 100644
index 0000000..ed939bf
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameIsAlphaNumeric2-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed
diff --git a/Tests/RunCMake/add_test/NameIsAlphaNumeric3-stdout.txt b/Tests/RunCMake/add_test/NameIsAlphaNumeric3-stdout.txt
new file mode 100644
index 0000000..ed939bf
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameIsAlphaNumeric3-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed
diff --git a/Tests/RunCMake/add_test/NameIsAlphaNumeric4-stdout.txt b/Tests/RunCMake/add_test/NameIsAlphaNumeric4-stdout.txt
new file mode 100644
index 0000000..ed939bf
--- /dev/null
+++ b/Tests/RunCMake/add_test/NameIsAlphaNumeric4-stdout.txt
@@ -0,0 +1 @@
+Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed
diff --git a/Tests/RunCMake/add_test/RunCMakeTest.cmake b/Tests/RunCMake/add_test/RunCMakeTest.cmake
new file mode 100644
index 0000000..6e9edda
--- /dev/null
+++ b/Tests/RunCMake/add_test/RunCMakeTest.cmake
@@ -0,0 +1,263 @@
+include(RunCTest)
+
+set(ENV{CTEST_OUTPUT_ON_FAILURE} 1)
+
+function(run_NameIsAlphaNumeric1_test)
+ set(CASE_CMAKELISTS_NAME_1 [==[ abcdefghijklmnopqrstuvwxyz0123456789 ]==])
+ set(CASE_CMAKELISTS_NAME_2 [==[ abcdefghijklmnopqrstuvwxyz0123456789 ]==])
+ run_ctest(NameIsAlphaNumeric1)
+endfunction()
+run_NameIsAlphaNumeric1_test()
+
+function(run_NameIsAlphaNumeric2_test)
+ set(CASE_CMAKELISTS_NAME_1 [==["abcdefghijklmnopqrstuvwxyz0123456789"]==])
+ set(CASE_CMAKELISTS_NAME_2 [==["abcdefghijklmnopqrstuvwxyz0123456789"]==])
+ run_ctest(NameIsAlphaNumeric2)
+endfunction()
+run_NameIsAlphaNumeric2_test()
+
+function(run_NameIsAlphaNumeric3_test)
+ set(CASE_CMAKELISTS_NAME_1 [==["abcdefghijklmnopqrstuvwxyz0123456789"]==])
+ set(CASE_CMAKELISTS_NAME_2 [==[ abcdefghijklmnopqrstuvwxyz0123456789 ]==])
+ run_ctest(NameIsAlphaNumeric3)
+endfunction()
+run_NameIsAlphaNumeric3_test()
+
+function(run_NameIsAlphaNumeric4_test)
+ set(CASE_CMAKELISTS_NAME_1 [==[ abcdefghijklmnopqrstuvwxyz0123456789 ]==])
+ set(CASE_CMAKELISTS_NAME_2 [==["abcdefghijklmnopqrstuvwxyz0123456789"]==])
+ run_ctest(NameIsAlphaNumeric4)
+endfunction()
+run_NameIsAlphaNumeric4_test()
+
+
+function(run_NameContainsValidSpecialChars1_test)
+ set(CASE_CMAKELISTS_NAME_1 [==[ abc_.+-012 ]==])
+ set(CASE_CMAKELISTS_NAME_2 [==[ abc_.+-012 ]==])
+ run_ctest(NameContainsValidSpecialChars1)
+endfunction()
+run_NameContainsValidSpecialChars1_test()
+
+function(run_NameContainsValidSpecialChars2_test)
+ set(CASE_CMAKELISTS_NAME_1 [==["abc_.+-012"]==])
+ set(CASE_CMAKELISTS_NAME_2 [==["abc_.+-012"]==])
+ run_ctest(NameContainsValidSpecialChars2)
+endfunction()
+run_NameContainsValidSpecialChars2_test()
+
+function(run_NameContainsValidSpecialChars3_test)
+ set(CASE_CMAKELISTS_NAME_1 [==["abc_.+-012"]==])
+ set(CASE_CMAKELISTS_NAME_2 [==[ abc_.+-012 ]==])
+ run_ctest(NameContainsValidSpecialChars3)
+endfunction()
+run_NameContainsValidSpecialChars3_test()
+
+function(run_NameContainsValidSpecialChars4_test)
+ set(CASE_CMAKELISTS_NAME_1 [==[ abc_.+-012 ]==])
+ set(CASE_CMAKELISTS_NAME_2 [==["abc_.+-012"]==])
+ run_ctest(NameContainsValidSpecialChars4)
+endfunction()
+run_NameContainsValidSpecialChars4_test()
+
+
+function(run_NameContainsOtherSpecialChars1_test)
+ set(CASE_CMAKELISTS_NAME_1 [==[ !§$%&/ü:*😤~ ]==])
+ set(CASE_CMAKELISTS_NAME_2 [==[ !§$%&/ü:*😤~ ]==])
+ run_ctest(NameContainsOtherSpecialChars1)
+endfunction()
+run_NameContainsOtherSpecialChars1_test()
+
+function(run_NameContainsOtherSpecialChars2_test)
+ set(CASE_CMAKELISTS_NAME_1 [==["!§$%&/ü:*😤~"]==])
+ set(CASE_CMAKELISTS_NAME_2 [==["!§$%&/ü:*😤~"]==])
+ run_ctest(NameContainsOtherSpecialChars2)
+endfunction()
+run_NameContainsOtherSpecialChars2_test()
+
+function(run_NameContainsOtherSpecialChars3_test)
+ set(CASE_CMAKELISTS_NAME_1 [==["!§$%&/ü:*😤~"]==])
+ set(CASE_CMAKELISTS_NAME_2 [==[ !§$%&/ü:*😤~ ]==])
+ run_ctest(NameContainsOtherSpecialChars3)
+endfunction()
+run_NameContainsOtherSpecialChars3_test()
+
+function(run_NameContainsOtherSpecialChars4_test)
+ set(CASE_CMAKELISTS_NAME_1 [==[ !§$%&/ü:*😤~ ]==])
+ set(CASE_CMAKELISTS_NAME_2 [==["!§$%&/ü:*😤~"]==])
+ run_ctest(NameContainsOtherSpecialChars4)
+endfunction()
+run_NameContainsOtherSpecialChars4_test()
+
+
+function(run_NameContainsEscapedSpecialChars1_test)
+ set(CASE_CMAKELISTS_NAME_1 [==[ \(\)\ \# ]==])
+ set(CASE_CMAKELISTS_NAME_2 [==[ \(\)\ \# ]==])
+ run_ctest(NameContainsEscapedSpecialChars1)
+endfunction()
+run_NameContainsEscapedSpecialChars1_test()
+
+function(run_NameContainsEscapedSpecialChars2_test)
+ set(CASE_CMAKELISTS_NAME_1 [==["\(\)\ \#"]==])
+ set(CASE_CMAKELISTS_NAME_2 [==["\(\)\ \#"]==])
+ run_ctest(NameContainsEscapedSpecialChars2)
+endfunction()
+run_NameContainsEscapedSpecialChars2_test()
+
+function(run_NameContainsEscapedSpecialChars3_test)
+ set(CASE_CMAKELISTS_NAME_1 [==["\(\)\ \#"]==])
+ set(CASE_CMAKELISTS_NAME_2 [==[ \(\)\ \# ]==])
+ run_ctest(NameContainsEscapedSpecialChars3)
+endfunction()
+run_NameContainsEscapedSpecialChars3_test()
+
+function(run_NameContainsEscapedSpecialChars4_test)
+ set(CASE_CMAKELISTS_NAME_1 [==[ \(\)\ \# ]==])
+ set(CASE_CMAKELISTS_NAME_2 [==["\(\)\ \#"]==])
+ run_ctest(NameContainsEscapedSpecialChars4)
+endfunction()
+run_NameContainsEscapedSpecialChars4_test()
+
+
+function(run_NameContainsGeneratorExpressionSyntax1_test)
+ set(CASE_CMAKELISTS_NAME_1 [==[ $<BOOL:0> ]==])
+ set(CASE_CMAKELISTS_NAME_2 [==[ $<BOOL:0> ]==])
+ run_ctest(NameContainsGeneratorExpressionSyntax1)
+endfunction()
+run_NameContainsGeneratorExpressionSyntax1_test()
+
+function(run_NameContainsGeneratorExpressionSyntax2_test)
+ set(CASE_CMAKELISTS_NAME_1 [==["$<BOOL:0>"]==])
+ set(CASE_CMAKELISTS_NAME_2 [==["$<BOOL:0>"]==])
+ run_ctest(NameContainsGeneratorExpressionSyntax2)
+endfunction()
+run_NameContainsGeneratorExpressionSyntax2_test()
+
+function(run_NameContainsGeneratorExpressionSyntax3_test)
+ set(CASE_CMAKELISTS_NAME_1 [==["$<BOOL:0>"]==])
+ set(CASE_CMAKELISTS_NAME_2 [==[ $<BOOL:0> ]==])
+ run_ctest(NameContainsGeneratorExpressionSyntax3)
+endfunction()
+run_NameContainsGeneratorExpressionSyntax3_test()
+
+function(run_NameContainsGeneratorExpressionSyntax4_test)
+ set(CASE_CMAKELISTS_NAME_1 [==[ $<BOOL:0> ]==])
+ set(CASE_CMAKELISTS_NAME_2 [==["$<BOOL:0>"]==])
+ run_ctest(NameContainsGeneratorExpressionSyntax4)
+endfunction()
+run_NameContainsGeneratorExpressionSyntax4_test()
+
+
+function(run_NameContainsSpaces1_test)
+ set(CASE_CMAKELISTS_NAME_1 [==["PrefixTest SuffixTest"]==])
+ set(CASE_CMAKELISTS_NAME_2 [==["PrefixTest SuffixTest"]==])
+ run_ctest(NameContainsSpaces1)
+endfunction()
+run_NameContainsSpaces1_test()
+
+function(run_NameContainsSpaces2_test)
+ set(CASE_CMAKELISTS_NAME_1 [==[ PrefixTest SuffixTest ]==])
+ set(CASE_CMAKELISTS_NAME_2 [==[ PrefixTest SuffixTest ]==])
+ run_ctest(NameContainsSpaces2)
+endfunction()
+run_NameContainsSpaces2_test()
+
+function(run_NameContainsSpaces3_test)
+ set(CASE_CMAKELISTS_NAME_1 [==["PrefixTest SuffixTest"]==])
+ set(CASE_CMAKELISTS_NAME_2 [==[ PrefixTest SuffixTest ]==])
+ run_ctest(NameContainsSpaces3)
+endfunction()
+run_NameContainsSpaces3_test()
+
+function(run_NameContainsSpaces4_test)
+ set(CASE_CMAKELISTS_NAME_1 [==[ PrefixTest SuffixTest ]==])
+ set(CASE_CMAKELISTS_NAME_2 [==["PrefixTest SuffixTest"]==])
+ run_ctest(NameContainsSpaces4)
+endfunction()
+run_NameContainsSpaces4_test()
+
+
+function(run_NameContainsSemicolon1_test)
+ set(CASE_CMAKELISTS_NAME_1 [==["PrefixTest;SuffixTest"]==])
+ set(CASE_CMAKELISTS_NAME_2 [==["PrefixTest;SuffixTest"]==])
+ run_ctest(NameContainsSemicolon1)
+endfunction()
+run_NameContainsSemicolon1_test()
+
+function(run_NameContainsSemicolon2_test)
+ set(CASE_CMAKELISTS_NAME_1 [==[ PrefixTest;SuffixTest ]==])
+ set(CASE_CMAKELISTS_NAME_2 [==[ PrefixTest;SuffixTest ]==])
+ run_ctest(NameContainsSemicolon2)
+endfunction()
+run_NameContainsSemicolon2_test()
+
+function(run_NameContainsSemicolon3_test)
+ set(CASE_CMAKELISTS_NAME_1 [==["PrefixTest;SuffixTest"]==])
+ set(CASE_CMAKELISTS_NAME_2 [==[ PrefixTest;SuffixTest ]==])
+ run_ctest(NameContainsSemicolon3)
+endfunction()
+run_NameContainsSemicolon3_test()
+
+function(run_NameContainsSemicolon4_test)
+ set(CASE_CMAKELISTS_NAME_1 [==[ PrefixTest;SuffixTest ]==])
+ set(CASE_CMAKELISTS_NAME_2 [==["PrefixTest;SuffixTest"]==])
+ run_ctest(NameContainsSemicolon4)
+endfunction()
+run_NameContainsSemicolon4_test()
+
+
+function(run_NameContainsEscapedQuote1_test)
+ set(CASE_CMAKELISTS_NAME_1 [==["EscapedQuote\"\"SuffixTest"]==])
+ set(CASE_CMAKELISTS_NAME_2 [==["EscapedQuote\"\"SuffixTest"]==])
+ run_ctest(NameContainsEscapedQuote1)
+endfunction()
+run_NameContainsEscapedQuote1_test()
+
+function(run_NameContainsEscapedQuote2_test)
+ set(CASE_CMAKELISTS_NAME_1 [==[ EscapedQuote\"\"SuffixTest ]==])
+ set(CASE_CMAKELISTS_NAME_2 [==[ EscapedQuote\"\"SuffixTest ]==])
+ run_ctest(NameContainsEscapedQuote2)
+endfunction()
+run_NameContainsEscapedQuote2_test()
+
+function(run_NameContainsEscapedQuote3_test)
+ set(CASE_CMAKELISTS_NAME_1 [==["EscapedQuote\"\"SuffixTest"]==])
+ set(CASE_CMAKELISTS_NAME_2 [==[ EscapedQuote\"\"SuffixTest ]==])
+ run_ctest(NameContainsEscapedQuote3)
+endfunction()
+run_NameContainsEscapedQuote3_test()
+
+function(run_NameContainsEscapedQuote4_test)
+ set(CASE_CMAKELISTS_NAME_1 [==[ EscapedQuote\"\"SuffixTest ]==])
+ set(CASE_CMAKELISTS_NAME_2 [==["EscapedQuote\"\"SuffixTest"]==])
+ run_ctest(NameContainsEscapedQuote4)
+endfunction()
+run_NameContainsEscapedQuote4_test()
+
+
+function(run_NameContainsBracketArgument1_test)
+ set(CASE_CMAKELISTS_NAME_1 [==["[=[BracketArgument;SuffixTest]=]"]==])
+ set(CASE_CMAKELISTS_NAME_2 [==["[=[BracketArgument;SuffixTest]=]"]==])
+ run_ctest(NameContainsBracketArgument1)
+endfunction()
+run_NameContainsBracketArgument1_test()
+
+function(run_NameContainsBracketArgument2_test)
+ set(CASE_CMAKELISTS_NAME_1 [==[ [=[BracketArgument;SuffixTest]=] ]==])
+ set(CASE_CMAKELISTS_NAME_2 [==[ [=[BracketArgument;SuffixTest]=] ]==])
+ run_ctest(NameContainsBracketArgument2)
+endfunction()
+run_NameContainsBracketArgument2_test()
+
+function(run_NameContainsBracketArgument3_test)
+ set(CASE_CMAKELISTS_NAME_1 [==["[=[BracketArgument;SuffixTest]=]"]==])
+ set(CASE_CMAKELISTS_NAME_2 [==[ [=[BracketArgument;SuffixTest]=] ]==])
+ run_ctest(NameContainsBracketArgument3)
+endfunction()
+run_NameContainsBracketArgument3_test()
+
+function(run_NameContainsBracketArgument4_test)
+ set(CASE_CMAKELISTS_NAME_1 [==[ [=[BracketArgument;SuffixTest]=] ]==])
+ set(CASE_CMAKELISTS_NAME_2 [==["[=[BracketArgument;SuffixTest]=]"]==])
+ run_ctest(NameContainsBracketArgument4)
+endfunction()
+run_NameContainsBracketArgument4_test()
diff --git a/Tests/RunCMake/add_test/test.cmake.in b/Tests/RunCMake/add_test/test.cmake.in
new file mode 100644
index 0000000..9821c1c
--- /dev/null
+++ b/Tests/RunCMake/add_test/test.cmake.in
@@ -0,0 +1,16 @@
+cmake_minimum_required(VERSION 3.17)
+
+set(CTEST_SITE "test-site")
+set(CTEST_BUILD_NAME "test-build-name")
+set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@")
+set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@-build")
+set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@")
+set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@")
+set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@")
+set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}")
+
+set(ctest_test_args "@CASE_CTEST_TEST_ARGS@")
+ctest_start(Experimental)
+ctest_configure()
+#ctest_build()
+ctest_test(${ctest_test_args})
diff --git a/Tests/RunCMake/cmake_command/RunCMakeTest.cmake b/Tests/RunCMake/cmake_command/RunCMakeTest.cmake
deleted file mode 100644
index 2b6e7a2..0000000
--- a/Tests/RunCMake/cmake_command/RunCMakeTest.cmake
+++ /dev/null
@@ -1,13 +0,0 @@
-include(RunCMake)
-
-run_cmake(cmake_command_no_parameters)
-run_cmake(cmake_command_unknown_meta_operation)
-run_cmake(cmake_command_invoke_message)
-run_cmake(cmake_command_invoke_message_fatal_error)
-run_cmake(cmake_command_invoke_no_parameters)
-run_cmake(cmake_command_invoke_unknown_function)
-run_cmake(cmake_command_eval_message)
-run_cmake(cmake_command_eval_message_fatal_error)
-run_cmake(cmake_command_eval_no_code)
-run_cmake(cmake_command_eval_no_parameters)
-run_cmake(cmake_command_eval_variable_outside_message)
diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_message.cmake b/Tests/RunCMake/cmake_command/cmake_command_eval_message.cmake
deleted file mode 100644
index 9ef5e25..0000000
--- a/Tests/RunCMake/cmake_command/cmake_command_eval_message.cmake
+++ /dev/null
@@ -1 +0,0 @@
-cmake_command(EVAL CODE message(WORKS!))
diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-stderr.txt
deleted file mode 100644
index 6a8a124..0000000
--- a/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-stderr.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-CMake Error at cmake_command_eval_message_fatal_error.cmake:1:EVAL:2 \(message\):
- error!
-Call Stack \(most recent call first\):
- cmake_command_eval_message_fatal_error.cmake:1 \(cmake_command\)
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_no_code-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_no_code-stderr.txt
deleted file mode 100644
index ee53312..0000000
--- a/Tests/RunCMake/cmake_command/cmake_command_eval_no_code-stderr.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-CMake Error at cmake_command_eval_no_code.cmake:1 \(cmake_command\):
- cmake_command called without CODE argument
diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_no_code.cmake b/Tests/RunCMake/cmake_command/cmake_command_eval_no_code.cmake
deleted file mode 100644
index 22e1667..0000000
--- a/Tests/RunCMake/cmake_command/cmake_command_eval_no_code.cmake
+++ /dev/null
@@ -1 +0,0 @@
-cmake_command(EVAL message "too many parameters")
diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-stderr.txt
deleted file mode 100644
index e9fc317..0000000
--- a/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-stderr.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-CMake Error at cmake_command_eval_no_parameters.cmake:1 \(cmake_command\):
- cmake_command called with incorrect number of arguments
diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters.cmake b/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters.cmake
deleted file mode 100644
index a5ba2c7..0000000
--- a/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters.cmake
+++ /dev/null
@@ -1 +0,0 @@
-cmake_command(EVAL)
diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message.cmake b/Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message.cmake
deleted file mode 100644
index b7a06a5..0000000
--- a/Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_command(EVAL CODE "set(phrase \"WORKS!\")")
-message(${phrase})
diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_message.cmake b/Tests/RunCMake/cmake_command/cmake_command_invoke_message.cmake
deleted file mode 100644
index 336d78a..0000000
--- a/Tests/RunCMake/cmake_command/cmake_command_invoke_message.cmake
+++ /dev/null
@@ -1 +0,0 @@
-cmake_command(INVOKE message WORKS!)
diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error-stderr.txt
deleted file mode 100644
index 2c9dab5..0000000
--- a/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error-stderr.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-CMake Error at cmake_command_invoke_message_fatal_error.cmake:1 \(message\):
- error!
-Call Stack \(most recent call first\):
- cmake_command_invoke_message_fatal_error.cmake:1 \(cmake_command\)
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error.cmake b/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error.cmake
deleted file mode 100644
index 6b42764..0000000
--- a/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error.cmake
+++ /dev/null
@@ -1 +0,0 @@
-cmake_command(INVOKE message FATAL_ERROR error!)
diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters-stderr.txt
deleted file mode 100644
index 7741b41..0000000
--- a/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters-stderr.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-CMake Error at cmake_command_invoke_no_parameters.cmake:1 \(cmake_command\):
- cmake_command called with incorrect number of arguments
diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters.cmake b/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters.cmake
deleted file mode 100644
index b9c5e14..0000000
--- a/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters.cmake
+++ /dev/null
@@ -1 +0,0 @@
-cmake_command(INVOKE)
diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function-stderr.txt
deleted file mode 100644
index 50a81a3..0000000
--- a/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function-stderr.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-CMake Error at cmake_command_invoke_unknown_function.cmake:1 \(unknown\):
- Unknown CMake command "unknown".
diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function.cmake b/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function.cmake
deleted file mode 100644
index f19a04b..0000000
--- a/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function.cmake
+++ /dev/null
@@ -1 +0,0 @@
-cmake_command(INVOKE unknown)
diff --git a/Tests/RunCMake/cmake_command/cmake_command_no_parameters-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_no_parameters-stderr.txt
deleted file mode 100644
index 772b604..0000000
--- a/Tests/RunCMake/cmake_command/cmake_command_no_parameters-stderr.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-CMake Error at cmake_command_no_parameters.cmake:1 \(cmake_command\):
- cmake_command called with incorrect number of arguments
diff --git a/Tests/RunCMake/cmake_command/cmake_command_no_parameters.cmake b/Tests/RunCMake/cmake_command/cmake_command_no_parameters.cmake
deleted file mode 100644
index b9c5e14..0000000
--- a/Tests/RunCMake/cmake_command/cmake_command_no_parameters.cmake
+++ /dev/null
@@ -1 +0,0 @@
-cmake_command(INVOKE)
diff --git a/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation-stderr.txt
deleted file mode 100644
index 7b9b915..0000000
--- a/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation-stderr.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-CMake Error at cmake_command_unknown_meta_operation.cmake:1 \(cmake_command\):
- cmake_command called with unknown meta-operation
diff --git a/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation.cmake b/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation.cmake
deleted file mode 100644
index f7c77e5..0000000
--- a/Tests/RunCMake/cmake_command/cmake_command_unknown_meta_operation.cmake
+++ /dev/null
@@ -1 +0,0 @@
-cmake_command(UNKNOWN)
diff --git a/Tests/RunCMake/cmake_command/CMakeLists.txt b/Tests/RunCMake/cmake_language/CMakeLists.txt
index 2632ffa..2632ffa 100644
--- a/Tests/RunCMake/cmake_command/CMakeLists.txt
+++ b/Tests/RunCMake/cmake_language/CMakeLists.txt
diff --git a/Tests/RunCMake/cmake_language/RunCMakeTest.cmake b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake
new file mode 100644
index 0000000..c556e42
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake
@@ -0,0 +1,23 @@
+include(RunCMake)
+
+run_cmake(no_parameters)
+run_cmake(unknown_meta_operation)
+run_cmake(call_double_evaluation)
+run_cmake(call_expanded_command)
+run_cmake(call_expanded_command_and_arguments)
+run_cmake(call_expanded_command_with_explicit_argument)
+run_cmake(call_expand_command_name)
+run_cmake(call_expand_function_name)
+run_cmake(call_message)
+run_cmake(call_message_fatal_error)
+run_cmake(call_no_parameters)
+run_cmake(call_preserve_arguments)
+run_cmake(call_unknown_function)
+run_cmake(eval_expand_command_name)
+run_cmake(eval_expanded_command_and_arguments)
+run_cmake(eval_extra_parameters_between_eval_and_code)
+run_cmake(eval_message)
+run_cmake(eval_message_fatal_error)
+run_cmake(eval_no_code)
+run_cmake(eval_no_parameters)
+run_cmake(eval_variable_outside_message)
diff --git a/Tests/RunCMake/cmake_language/call_double_evaluation-stderr.txt b/Tests/RunCMake/cmake_language/call_double_evaluation-stderr.txt
new file mode 100644
index 0000000..59a70bd
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/call_double_evaluation-stderr.txt
@@ -0,0 +1 @@
+var='\${foo}'
diff --git a/Tests/RunCMake/cmake_language/call_double_evaluation.cmake b/Tests/RunCMake/cmake_language/call_double_evaluation.cmake
new file mode 100644
index 0000000..cf8fc91
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/call_double_evaluation.cmake
@@ -0,0 +1,2 @@
+set(var [[${foo}]])
+cmake_language(CALL cmake_language CALL message "var='${var}'")
diff --git a/Tests/RunCMake/cmake_language/call_expand_command_name-stderr.txt b/Tests/RunCMake/cmake_language/call_expand_command_name-stderr.txt
new file mode 100644
index 0000000..d640661
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/call_expand_command_name-stderr.txt
@@ -0,0 +1 @@
+OK!
diff --git a/Tests/RunCMake/cmake_language/call_expand_command_name.cmake b/Tests/RunCMake/cmake_language/call_expand_command_name.cmake
new file mode 100644
index 0000000..e03bb1f
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/call_expand_command_name.cmake
@@ -0,0 +1,2 @@
+set (my_call "CALL")
+cmake_language (${my_call} message "OK!")
diff --git a/Tests/RunCMake/cmake_command/cmake_command_no_parameters-result.txt b/Tests/RunCMake/cmake_language/call_expand_function_name-stderr.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/cmake_command/cmake_command_no_parameters-result.txt
+++ b/Tests/RunCMake/cmake_language/call_expand_function_name-stderr.txt
diff --git a/Tests/RunCMake/cmake_language/call_expand_function_name.cmake b/Tests/RunCMake/cmake_language/call_expand_function_name.cmake
new file mode 100644
index 0000000..565a7df
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/call_expand_function_name.cmake
@@ -0,0 +1,11 @@
+function(some_function_1)
+ message(1)
+endfunction()
+
+function(some_function_2)
+ message(2)
+endfunction()
+
+set(function_version 1)
+
+cmake_language(CALL some_function_${function_version})
diff --git a/Tests/RunCMake/cmake_language/call_expanded_command-stderr.txt b/Tests/RunCMake/cmake_language/call_expanded_command-stderr.txt
new file mode 100644
index 0000000..d640661
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/call_expanded_command-stderr.txt
@@ -0,0 +1 @@
+OK!
diff --git a/Tests/RunCMake/cmake_language/call_expanded_command.cmake b/Tests/RunCMake/cmake_language/call_expanded_command.cmake
new file mode 100644
index 0000000..e76e612
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/call_expanded_command.cmake
@@ -0,0 +1,6 @@
+function (itsok)
+ message(OK!)
+endfunction()
+
+set (cmd CALL itsok)
+cmake_language (${cmd})
diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function-result.txt b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/cmake_command/cmake_command_invoke_unknown_function-result.txt
+++ b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-result.txt
diff --git a/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-stderr.txt b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-stderr.txt
new file mode 100644
index 0000000..e87e9bc
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at call_expanded_command_and_arguments.cmake:2 \(cmake_language\):
+ cmake_language called with incorrect number of arguments
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments.cmake b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments.cmake
new file mode 100644
index 0000000..4ce6b34
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/call_expanded_command_and_arguments.cmake
@@ -0,0 +1,2 @@
+set(call_message CALL message a b)
+cmake_language(${call_message})
diff --git a/Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument-stderr.txt b/Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument-stderr.txt
new file mode 100644
index 0000000..d640661
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument-stderr.txt
@@ -0,0 +1 @@
+OK!
diff --git a/Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument.cmake b/Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument.cmake
new file mode 100644
index 0000000..0563400
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/call_expanded_command_with_explicit_argument.cmake
@@ -0,0 +1,2 @@
+set (cmd CALL message)
+cmake_language (${cmd} "OK!")
diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_message-stderr.txt b/Tests/RunCMake/cmake_language/call_message-stderr.txt
index cfc8694..cfc8694 100644
--- a/Tests/RunCMake/cmake_command/cmake_command_invoke_message-stderr.txt
+++ b/Tests/RunCMake/cmake_language/call_message-stderr.txt
diff --git a/Tests/RunCMake/cmake_language/call_message.cmake b/Tests/RunCMake/cmake_language/call_message.cmake
new file mode 100644
index 0000000..31aefdf
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/call_message.cmake
@@ -0,0 +1 @@
+cmake_language(CALL message WORKS!)
diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters-result.txt b/Tests/RunCMake/cmake_language/call_message_fatal_error-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/cmake_command/cmake_command_invoke_no_parameters-result.txt
+++ b/Tests/RunCMake/cmake_language/call_message_fatal_error-result.txt
diff --git a/Tests/RunCMake/cmake_language/call_message_fatal_error-stderr.txt b/Tests/RunCMake/cmake_language/call_message_fatal_error-stderr.txt
new file mode 100644
index 0000000..83eb3d8
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/call_message_fatal_error-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at call_message_fatal_error.cmake:1 \(message\):
+ error!
+Call Stack \(most recent call first\):
+ call_message_fatal_error.cmake:1 \(cmake_language\)
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/cmake_language/call_message_fatal_error.cmake b/Tests/RunCMake/cmake_language/call_message_fatal_error.cmake
new file mode 100644
index 0000000..935b437
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/call_message_fatal_error.cmake
@@ -0,0 +1 @@
+cmake_language(CALL message FATAL_ERROR error!)
diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error-result.txt b/Tests/RunCMake/cmake_language/call_no_parameters-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/cmake_command/cmake_command_invoke_message_fatal_error-result.txt
+++ b/Tests/RunCMake/cmake_language/call_no_parameters-result.txt
diff --git a/Tests/RunCMake/cmake_language/call_no_parameters-stderr.txt b/Tests/RunCMake/cmake_language/call_no_parameters-stderr.txt
new file mode 100644
index 0000000..9e2c08f
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/call_no_parameters-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at call_no_parameters.cmake:1 \(cmake_language\):
+ cmake_language called with incorrect number of arguments
diff --git a/Tests/RunCMake/cmake_language/call_no_parameters.cmake b/Tests/RunCMake/cmake_language/call_no_parameters.cmake
new file mode 100644
index 0000000..8353e08
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/call_no_parameters.cmake
@@ -0,0 +1 @@
+cmake_language(CALL)
diff --git a/Tests/RunCMake/cmake_language/call_preserve_arguments-stderr.txt b/Tests/RunCMake/cmake_language/call_preserve_arguments-stderr.txt
new file mode 100644
index 0000000..8ec5483
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/call_preserve_arguments-stderr.txt
@@ -0,0 +1,6 @@
+foo\(...\)
+\[a;b\]
+\[c;d\]
+cmake_language\(CALL foo ...\)
+\[a;b\]
+\[c;d\]
diff --git a/Tests/RunCMake/cmake_language/call_preserve_arguments.cmake b/Tests/RunCMake/cmake_language/call_preserve_arguments.cmake
new file mode 100644
index 0000000..bfef0fd
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/call_preserve_arguments.cmake
@@ -0,0 +1,12 @@
+function(foo arg1 arg2)
+ math(EXPR last "${ARGC} - 1")
+ foreach(i RANGE 0 ${last})
+ message("[${ARGV${i}}]")
+ endforeach()
+endfunction()
+
+message("foo(...)")
+foo("a;b" "c;d")
+
+message("cmake_language(CALL foo ...)")
+cmake_language(CALL foo "a;b" "c;d")
diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-result.txt b/Tests/RunCMake/cmake_language/call_unknown_function-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-result.txt
+++ b/Tests/RunCMake/cmake_language/call_unknown_function-result.txt
diff --git a/Tests/RunCMake/cmake_language/call_unknown_function-stderr.txt b/Tests/RunCMake/cmake_language/call_unknown_function-stderr.txt
new file mode 100644
index 0000000..d09e708
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/call_unknown_function-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at call_unknown_function.cmake:1 \(unknown\):
+ Unknown CMake command "unknown".
diff --git a/Tests/RunCMake/cmake_language/call_unknown_function.cmake b/Tests/RunCMake/cmake_language/call_unknown_function.cmake
new file mode 100644
index 0000000..efd6baf
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/call_unknown_function.cmake
@@ -0,0 +1 @@
+cmake_language(CALL unknown)
diff --git a/Tests/RunCMake/cmake_language/eval_expand_command_name-stderr.txt b/Tests/RunCMake/cmake_language/eval_expand_command_name-stderr.txt
new file mode 100644
index 0000000..d640661
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/eval_expand_command_name-stderr.txt
@@ -0,0 +1 @@
+OK!
diff --git a/Tests/RunCMake/cmake_language/eval_expand_command_name.cmake b/Tests/RunCMake/cmake_language/eval_expand_command_name.cmake
new file mode 100644
index 0000000..2397232
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/eval_expand_command_name.cmake
@@ -0,0 +1,2 @@
+set (my_eval "EVAL")
+cmake_language (${my_eval} CODE message("OK!"))
diff --git a/Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments-stderr.txt b/Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments-stderr.txt
new file mode 100644
index 0000000..d640661
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments-stderr.txt
@@ -0,0 +1 @@
+OK!
diff --git a/Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments.cmake b/Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments.cmake
new file mode 100644
index 0000000..f7d2d51
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/eval_expanded_command_and_arguments.cmake
@@ -0,0 +1,2 @@
+set(cmd EVAL CODE [[message("OK!")]])
+cmake_language(${cmd})
diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_no_code-result.txt b/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/cmake_command/cmake_command_eval_no_code-result.txt
+++ b/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-result.txt
diff --git a/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-stderr.txt b/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-stderr.txt
new file mode 100644
index 0000000..d32054f
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at eval_extra_parameters_between_eval_and_code.cmake:1 \(cmake_language\):
+ cmake_language called with unsupported arguments between EVAL and CODE
+ arguments
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code.cmake b/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code.cmake
new file mode 100644
index 0000000..7c004d7
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/eval_extra_parameters_between_eval_and_code.cmake
@@ -0,0 +1 @@
+cmake_language(EVAL BAD CODE "message(BAD CODE)")
diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message-stderr.txt b/Tests/RunCMake/cmake_language/eval_message-stderr.txt
index cfc8694..cfc8694 100644
--- a/Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message-stderr.txt
+++ b/Tests/RunCMake/cmake_language/eval_message-stderr.txt
diff --git a/Tests/RunCMake/cmake_language/eval_message.cmake b/Tests/RunCMake/cmake_language/eval_message.cmake
new file mode 100644
index 0000000..91edcdd
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/eval_message.cmake
@@ -0,0 +1 @@
+cmake_language(EVAL CODE message(WORKS!))
diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-result.txt b/Tests/RunCMake/cmake_language/eval_message_fatal_error-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-result.txt
+++ b/Tests/RunCMake/cmake_language/eval_message_fatal_error-result.txt
diff --git a/Tests/RunCMake/cmake_language/eval_message_fatal_error-stderr.txt b/Tests/RunCMake/cmake_language/eval_message_fatal_error-stderr.txt
new file mode 100644
index 0000000..5cf11e3
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/eval_message_fatal_error-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at eval_message_fatal_error.cmake:1:EVAL:2 \(message\):
+ error!
+Call Stack \(most recent call first\):
+ eval_message_fatal_error.cmake:1 \(cmake_language\)
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error.cmake b/Tests/RunCMake/cmake_language/eval_message_fatal_error.cmake
index 22913de..72e155d 100644
--- a/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error.cmake
+++ b/Tests/RunCMake/cmake_language/eval_message_fatal_error.cmake
@@ -1,4 +1,4 @@
-cmake_command(EVAL CODE
+cmake_language(EVAL CODE
"
message(FATAL_ERROR error!)
"
diff --git a/Tests/RunCMake/cmake_language/eval_no_code-result.txt b/Tests/RunCMake/cmake_language/eval_no_code-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/eval_no_code-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_language/eval_no_code-stderr.txt b/Tests/RunCMake/cmake_language/eval_no_code-stderr.txt
new file mode 100644
index 0000000..608ba88
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/eval_no_code-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at eval_no_code.cmake:1 \(cmake_language\):
+ cmake_language called without CODE argument
diff --git a/Tests/RunCMake/cmake_language/eval_no_code.cmake b/Tests/RunCMake/cmake_language/eval_no_code.cmake
new file mode 100644
index 0000000..7f5bc21
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/eval_no_code.cmake
@@ -0,0 +1 @@
+cmake_language(EVAL message "too many parameters")
diff --git a/Tests/RunCMake/cmake_language/eval_no_parameters-result.txt b/Tests/RunCMake/cmake_language/eval_no_parameters-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/eval_no_parameters-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_language/eval_no_parameters-stderr.txt b/Tests/RunCMake/cmake_language/eval_no_parameters-stderr.txt
new file mode 100644
index 0000000..6166898
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/eval_no_parameters-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at eval_no_parameters.cmake:1 \(cmake_language\):
+ cmake_language called with incorrect number of arguments
diff --git a/Tests/RunCMake/cmake_language/eval_no_parameters.cmake b/Tests/RunCMake/cmake_language/eval_no_parameters.cmake
new file mode 100644
index 0000000..e7ae808
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/eval_no_parameters.cmake
@@ -0,0 +1 @@
+cmake_language(EVAL)
diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_message-stderr.txt b/Tests/RunCMake/cmake_language/eval_variable_outside_message-stderr.txt
index cfc8694..cfc8694 100644
--- a/Tests/RunCMake/cmake_command/cmake_command_eval_message-stderr.txt
+++ b/Tests/RunCMake/cmake_language/eval_variable_outside_message-stderr.txt
diff --git a/Tests/RunCMake/cmake_language/eval_variable_outside_message.cmake b/Tests/RunCMake/cmake_language/eval_variable_outside_message.cmake
new file mode 100644
index 0000000..71f0457
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/eval_variable_outside_message.cmake
@@ -0,0 +1,2 @@
+cmake_language(EVAL CODE "set(phrase \"WORKS!\")")
+message(${phrase})
diff --git a/Tests/RunCMake/cmake_language/no_parameters-result.txt b/Tests/RunCMake/cmake_language/no_parameters-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/no_parameters-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_language/no_parameters-stderr.txt b/Tests/RunCMake/cmake_language/no_parameters-stderr.txt
new file mode 100644
index 0000000..194bbe3
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/no_parameters-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at no_parameters.cmake:1 \(cmake_language\):
+ cmake_language called with incorrect number of arguments
diff --git a/Tests/RunCMake/cmake_language/no_parameters.cmake b/Tests/RunCMake/cmake_language/no_parameters.cmake
new file mode 100644
index 0000000..8353e08
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/no_parameters.cmake
@@ -0,0 +1 @@
+cmake_language(CALL)
diff --git a/Tests/RunCMake/cmake_language/unknown_meta_operation-result.txt b/Tests/RunCMake/cmake_language/unknown_meta_operation-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/unknown_meta_operation-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_language/unknown_meta_operation-stderr.txt b/Tests/RunCMake/cmake_language/unknown_meta_operation-stderr.txt
new file mode 100644
index 0000000..6a1d4fd
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/unknown_meta_operation-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at unknown_meta_operation.cmake:1 \(cmake_language\):
+ cmake_language called with unknown meta-operation
diff --git a/Tests/RunCMake/cmake_language/unknown_meta_operation.cmake b/Tests/RunCMake/cmake_language/unknown_meta_operation.cmake
new file mode 100644
index 0000000..699f36f
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/unknown_meta_operation.cmake
@@ -0,0 +1 @@
+cmake_language(UNKNOWN)
diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
index 34d4020..18ae793 100644
--- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
@@ -107,3 +107,14 @@ add_test(NAME NotRunTest COMMAND ${CMAKE_COMMAND} -E true)
run_ctest_test(stop-on-failure STOP_ON_FAILURE)
endfunction()
run_stop_on_failure()
+
+# Make sure environment gets logged
+function(run_environment)
+ set(ENV{BAD_ENVIRONMENT_VARIABLE} "Bad environment variable")
+ set(CASE_CMAKELISTS_SUFFIX_CODE [[
+set_property(TEST RunCMakeVersion PROPERTY ENVIRONMENT "ENV1=env1;ENV2=env2")
+ ]])
+
+ run_ctest(TestEnvironment)
+endfunction()
+run_environment()
diff --git a/Tests/RunCMake/ctest_test/TestEnvironment-check.cmake b/Tests/RunCMake/ctest_test/TestEnvironment-check.cmake
new file mode 100644
index 0000000..91c9731
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/TestEnvironment-check.cmake
@@ -0,0 +1,10 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/Testing/TAG" _tag)
+string(REGEX REPLACE "^([^\n]*)\n.*$" "\\1" _date "${_tag}")
+file(READ "${RunCMake_TEST_BINARY_DIR}/Testing/${_date}/Test.xml" _test_contents)
+
+if(NOT _test_contents MATCHES "<Value>ENV1=env1\nENV2=env2\n#CTEST_RESOURCE_GROUP_COUNT=</Value>")
+ string(APPEND RunCMake_TEST_FAILED "Could not find expected environment variables in Test.xml")
+endif()
+if(_test_contents MATCHES "BAD_ENVIRONMENT_VARIABLE")
+ string(APPEND RunCMake_TEST_FAILED "Found BAD_ENVIRONMENT_VARIABLE in Test.xml")
+endif()
diff --git a/Tests/RunCMake/get_property/RunCMakeTest.cmake b/Tests/RunCMake/get_property/RunCMakeTest.cmake
index 6e36473..c4ee53d 100644
--- a/Tests/RunCMake/get_property/RunCMakeTest.cmake
+++ b/Tests/RunCMake/get_property/RunCMakeTest.cmake
@@ -5,6 +5,7 @@ run_cmake(directory_properties)
run_cmake(global_properties)
run_cmake(install_properties)
run_cmake(source_properties)
+run_cmake(source_properties_failures)
run_cmake(target_properties)
run_cmake(test_properties)
run_cmake(DebugConfigurations)
diff --git a/Tests/RunCMake/get_property/source_properties_failures-result.txt b/Tests/RunCMake/get_property/source_properties_failures-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/get_property/source_properties_failures-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/get_property/source_properties_failures-stderr.txt b/Tests/RunCMake/get_property/source_properties_failures-stderr.txt
new file mode 100644
index 0000000..a500e2e
--- /dev/null
+++ b/Tests/RunCMake/get_property/source_properties_failures-stderr.txt
@@ -0,0 +1,66 @@
+^CMake Error at source_properties_failures.cmake:1 \(set_source_files_properties\):
+ set_source_files_properties called with incorrect number of arguments no
+ value provided to the DIRECTORY option
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at source_properties_failures.cmake:2 \(set_source_files_properties\):
+ set_source_files_properties given non-existent DIRECTORY non_existing_dir
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at source_properties_failures.cmake:3 \(set_source_files_properties\):
+ set_source_files_properties called with incorrect number of arguments no
+ value provided to the TARGET_DIRECTORY option
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at source_properties_failures.cmake:4 \(set_source_files_properties\):
+ set_source_files_properties given non-existent target for DIRECTORY_TARGET
+ non_existing_target
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at source_properties_failures.cmake:6 \(get_property\):
+ get_property called with incorrect number of arguments no value provided to
+ the DIRECTORY option
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at source_properties_failures.cmake:7 \(get_property\):
+ get_property given non-existent DIRECTORY non_existing_dir
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at source_properties_failures.cmake:8 \(get_property\):
+ get_property called with incorrect number of arguments no value provided to
+ the TARGET_DIRECTORY option
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at source_properties_failures.cmake:9 \(get_property\):
+ get_property given non-existent target for DIRECTORY_TARGET
+ non_existing_dir
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at source_properties_failures.cmake:11 \(get_source_file_property\):
+ get_source_file_property given non-existent DIRECTORY PROPERTY
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at source_properties_failures.cmake:12 \(get_source_file_property\):
+ get_source_file_property called with incorrect number of arguments
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at source_properties_failures.cmake:13 \(get_source_file_property\):
+ get_source_file_property given non-existent target for DIRECTORY_TARGET
+ PROPERTY
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at source_properties_failures.cmake:14 \(get_source_file_property\):
+ get_source_file_property called with incorrect number of arguments
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/get_property/source_properties_failures.cmake b/Tests/RunCMake/get_property/source_properties_failures.cmake
new file mode 100644
index 0000000..f4b87f9
--- /dev/null
+++ b/Tests/RunCMake/get_property/source_properties_failures.cmake
@@ -0,0 +1,14 @@
+set_source_files_properties(a.txt DIRECTORY PROPERTIES COMPILE_DEFINITIONS "def")
+set_source_files_properties(a.txt DIRECTORY non_existing_dir PROPERTIES COMPILE_DEFINITIONS "def")
+set_source_files_properties(a.txt TARGET_DIRECTORY PROPERTIES COMPILE_DEFINITIONS "def")
+set_source_files_properties(a.txt TARGET_DIRECTORY non_existing_target PROPERTIES COMPILE_DEFINITIONS "def")
+
+get_property(in_var SOURCE a.txt DIRECTORY PROPERTY COMPILE_DEFINITIONS)
+get_property(in_var SOURCE a.txt DIRECTORY non_existing_dir PROPERTY COMPILE_DEFINITIONS)
+get_property(in_var SOURCE a.txt TARGET_DIRECTORY PROPERTY COMPILE_DEFINITIONS)
+get_property(in_var SOURCE a.txt TARGET_DIRECTORY non_existing_dir PROPERTY COMPILE_DEFINITIONS)
+
+get_source_file_property(in_var a.txt DIRECTORY PROPERTY COMPILE_DEFINITIONS)
+get_source_file_property(in_var a.txt DIRECTORY non_existing_dir PROPERTY COMPILE_DEFINITIONS)
+get_source_file_property(in_var a.txt TARGET_DIRECTORY PROPERTY COMPILE_DEFINITIONS)
+get_source_file_property(in_var a.txt TARGET_DIRECTORY non_existing_dir PROPERTY COMPILE_DEFINITIONS)
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake
index bd0bbe3..a681c7e 100644
--- a/Tests/RunCMake/install/RunCMakeTest.cmake
+++ b/Tests/RunCMake/install/RunCMakeTest.cmake
@@ -174,6 +174,13 @@ elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
run_cmake(file-GET_RUNTIME_DEPENDENCIES-badargs1)
run_cmake(file-GET_RUNTIME_DEPENDENCIES-badargs2)
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
+ if(DEFINED ENV{LDFLAGS})
+ # Some setups prebake disable-new-dtags into LDFLAGS
+ set(new_ldflags $ENV{LDFLAGS}})
+ string(REPLACE "-Wl,--disable-new-dtags" "" new_ldflags "${new_ldflags}")
+ set(ENV{LDFLAGS} "${new_ldflags}")
+ endif()
+
if(NOT CMAKE_C_COMPILER_ID MATCHES "^XL")
run_install_test(file-GET_RUNTIME_DEPENDENCIES-linux)
endif()
diff --git a/Tests/RunCMake/set_property/RunCMakeTest.cmake b/Tests/RunCMake/set_property/RunCMakeTest.cmake
index 8d4614c..692c6b9 100644
--- a/Tests/RunCMake/set_property/RunCMakeTest.cmake
+++ b/Tests/RunCMake/set_property/RunCMakeTest.cmake
@@ -9,6 +9,7 @@ run_cmake(LINK_OPTIONS)
run_cmake(LINK_DIRECTORIES)
run_cmake(LINK_LIBRARIES)
run_cmake(SOURCES)
+run_cmake(SOURCE_FILE)
run_cmake(TYPE)
run_cmake(USER_PROP)
run_cmake(USER_PROP_INHERITED)
diff --git a/Tests/RunCMake/set_property/SOURCE_FILE-result.txt b/Tests/RunCMake/set_property/SOURCE_FILE-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/set_property/SOURCE_FILE-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/set_property/SOURCE_FILE-stderr.txt b/Tests/RunCMake/set_property/SOURCE_FILE-stderr.txt
new file mode 100644
index 0000000..2e0b238
--- /dev/null
+++ b/Tests/RunCMake/set_property/SOURCE_FILE-stderr.txt
@@ -0,0 +1,22 @@
+^CMake Error at SOURCE_FILE.cmake:1 \(set_property\):
+ set_property called with incorrect number of arguments no value provided to
+ the DIRECTORY option
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at SOURCE_FILE.cmake:2 \(set_property\):
+ set_property given non-existent DIRECTORY non_existing_dir
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at SOURCE_FILE.cmake:3 \(set_property\):
+ set_property called with incorrect number of arguments no value provided to
+ the TARGET_DIRECTORY option
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at SOURCE_FILE.cmake:4 \(set_property\):
+ set_property given non-existent target for DIRECTORY_TARGET
+ non_existing_target
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/set_property/SOURCE_FILE.cmake b/Tests/RunCMake/set_property/SOURCE_FILE.cmake
new file mode 100644
index 0000000..b1d78bd
--- /dev/null
+++ b/Tests/RunCMake/set_property/SOURCE_FILE.cmake
@@ -0,0 +1,4 @@
+set_property(SOURCE a.txt DIRECTORY PROPERTY COMPILE_DEFINITIONS "def")
+set_property(SOURCE a.txt DIRECTORY non_existing_dir PROPERTY COMPILE_DEFINITIONS "def")
+set_property(SOURCE a.txt TARGET_DIRECTORY PROPERTY COMPILE_DEFINITIONS "def")
+set_property(SOURCE a.txt TARGET_DIRECTORY non_existing_target PROPERTY COMPILE_DEFINITIONS "def")
diff --git a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake
index b919f48..8ef13f9 100644
--- a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake
+++ b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake
@@ -50,10 +50,14 @@ if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel")
run_cmake_target(genex_DEVICE_LINK interface LinkOptions_shared_interface --config Release)
run_cmake_target(genex_DEVICE_LINK private LinkOptions_private --config Release)
if (CMake_TEST_CUDA)
- run_cmake_target(genex_DEVICE_LINK CMP0105_UNSET LinkOptions_CMP0105_UNSET --config Release)
- run_cmake_target(genex_DEVICE_LINK CMP0105_OLD LinkOptions_CMP0105_OLD --config Release)
- run_cmake_target(genex_DEVICE_LINK CMP0105_NEW LinkOptions_CMP0105_NEW --config Release)
- run_cmake_target(genex_DEVICE_LINK device LinkOptions_device --config Release)
+ # Separable compilation is only supported on NVCC.
+ if(NOT CMake_TEST_CUDA STREQUAL "Clang")
+ run_cmake_target(genex_DEVICE_LINK CMP0105_UNSET LinkOptions_CMP0105_UNSET --config Release)
+ run_cmake_target(genex_DEVICE_LINK CMP0105_OLD LinkOptions_CMP0105_OLD --config Release)
+ run_cmake_target(genex_DEVICE_LINK CMP0105_NEW LinkOptions_CMP0105_NEW --config Release)
+ run_cmake_target(genex_DEVICE_LINK device LinkOptions_device --config Release)
+ endif()
+
run_cmake_target(genex_DEVICE_LINK no_device LinkOptions_no_device --config Release)
endif()
diff --git a/Tests/SourceGroups/CMakeLists.txt b/Tests/SourceGroups/CMakeLists.txt
index a5740bb..d726395 100644
--- a/Tests/SourceGroups/CMakeLists.txt
+++ b/Tests/SourceGroups/CMakeLists.txt
@@ -30,6 +30,9 @@ source_group(Base\\Sub1\\Base FILES bar.c)
# a group without files, is currently not created
source_group(EmptyGroup)
+# Forward slashes can be delimiters too
+source_group(Base/Nested FILES nested.c)
+
set(root ${CMAKE_CURRENT_SOURCE_DIR})
set(tree_files_without_prefix ${root}/sub1/tree_bar.c
@@ -58,4 +61,5 @@ source_group(PREFIX "" FILES ${tree_files_with_empty_prefix} TREE ${root})
add_executable(SourceGroups main.c bar.c foo.c sub1/foo.c sub1/foobar.c baz.c
${tree_files_with_prefix} ${tree_files_without_prefix}
- ${tree_files_with_empty_prefix} README.txt)
+ ${tree_files_with_empty_prefix} README.txt
+ nested.c)
diff --git a/Tests/SourceGroups/main.c b/Tests/SourceGroups/main.c
index 87225f5..f646b49 100644
--- a/Tests/SourceGroups/main.c
+++ b/Tests/SourceGroups/main.c
@@ -12,6 +12,7 @@ extern int tree_empty_prefix_bar(void);
extern int tree_bar(void);
extern int tree_foobar(void);
extern int tree_baz(void);
+extern int nested(void);
int main()
{
@@ -23,5 +24,8 @@ int main()
"tree_empty_prefix_bar: %d\n",
tree_prefix_foo(), tree_prefix_bar(), tree_bar(), tree_foobar(),
tree_baz(), tree_empty_prefix_foo(), tree_empty_prefix_bar());
+
+ printf("nested: %d\n", nested());
+
return 0;
}
diff --git a/Tests/SourceGroups/nested.c b/Tests/SourceGroups/nested.c
new file mode 100644
index 0000000..4e31480
--- /dev/null
+++ b/Tests/SourceGroups/nested.c
@@ -0,0 +1,4 @@
+int nested(void)
+{
+ return 123;
+}
diff --git a/Tests/VSWindowsFormsResx/WindowsFormsResx/MyForm.cpp b/Tests/VSWindowsFormsResx/WindowsFormsResx/MyForm.cpp
index 154e268..0c37370 100644
--- a/Tests/VSWindowsFormsResx/WindowsFormsResx/MyForm.cpp
+++ b/Tests/VSWindowsFormsResx/WindowsFormsResx/MyForm.cpp
@@ -1 +1 @@
-#include "MyForm.h" \ No newline at end of file
+#include "MyForm.h"
diff --git a/Utilities/IWYU/mapping.imp b/Utilities/IWYU/mapping.imp
index 87e8bad..66cb282 100644
--- a/Utilities/IWYU/mapping.imp
+++ b/Utilities/IWYU/mapping.imp
@@ -97,54 +97,15 @@
{ symbol: [ "std::enable_if<true, std::chrono::duration<long, std::ratio<60, 1> > >::type", private, "\"cmConfigure.h\"", public ] },
{ symbol: [ "std::enable_if<true, std::chrono::duration<long, std::ratio<1, 1000> > >::type", private, "\"cmConfigure.h\"", public ] },
- # KWIML
- { include: [ "<stdint.h>", public, "\"cm_kwiml.h\"", public ] },
- { include: [ "<inttypes.h>", public, "\"cm_kwiml.h\"", public ] },
-
- # Self-sufficient wrapper for <sys/stat.h>
- { symbol: [ "mode_t", private, "\"cm_sys_stat.h\"", public ] },
-
- # Wrappers for 3rd-party libraries used from the system.
- { include: [ "<archive.h>", private, "\"cm_libarchive.h\"", public ] },
- { include: [ "<archive_entry.h>", private, "\"cm_libarchive.h\"", public ] },
- { include: [ "@<curl/.+\\.h>", private, "\"cm_curl.h\"", public ] },
- { include: [ "<expat.h>", private, "\"cm_expat.h\"", public ] },
- { include: [ "<expat_external.h>", private, "\"cm_expat.h\"", public ] },
- { include: [ "<json/reader.h>", private, "\"cm_jsoncpp_reader.h\"", public ] },
- { include: [ "<json/value.h>", private, "\"cm_jsoncpp_value.h\"", public ] },
- { include: [ "<json/writer.h>", private, "\"cm_jsoncpp_writer.h\"", public ] },
- { include: [ "<rhash.h>", private, "\"cm_rhash.h\"", public ] },
- { include: [ "<uv.h>", private, "\"cm_uv.h\"", public ] },
- { include: [ "@<uv[/-].+\\.h>", private, "\"cm_uv.h\"", public ] },
- { include: [ "<kwiml/abi.h>", private, "\"cm_kwiml.h\"", public ] },
- { include: [ "<kwiml/int.h>", private, "\"cm_kwiml.h\"", public ] },
- { include: [ "<zconf.h>", private, "\"cm_zlib.h\"", public ] },
- { include: [ "<zlib.h>", private, "\"cm_zlib.h\"", public ] },
-
- # Wrappers for bundled 3rd-party libraries.
- { include: [ "\"cmlibarchive/libarchive/archive.h\"", private, "\"cm_libarchive.h\"", public ] },
- { include: [ "\"cmlibarchive/libarchive/archive_entry.h\"", private, "\"cm_libarchive.h\"", public ] },
- { include: [ "@\"cmcurl/include/curl/.+\\.h\"", private, "\"cm_curl.h\"", public ] },
- { include: [ "\"cmexpat/lib/expat.h\"", private, "\"cm_expat.h\"", public ] },
- { include: [ "\"cmexpat/lib/expat_external.h\"", private, "\"cm_expat.h\"", public ] },
- { include: [ "\"cmjsoncpp/include/json/reader.h\"", private, "\"cm_jsoncpp_reader.h\"", public ] },
- { include: [ "\"cmjsoncpp/include/json/value.h\"", private, "\"cm_jsoncpp_value.h\"", public ] },
- { include: [ "\"cmjsoncpp/include/json/writer.h\"", private, "\"cm_jsoncpp_writer.h\"", public ] },
- { include: [ "\"cmlibrhash/librhash/rhash.h\"", private, "\"cm_rhash.h\"", public ] },
- { include: [ "\"cmlibuv/include/uv.h\"", private, "\"cm_uv.h\"", public ] },
- { include: [ "@\"cmlibuv/include/uv/.+\\.h\"", private, "\"cm_uv.h\"", public ] },
- { include: [ "\"KWIML/include/kwiml/abi.h\"", private, "\"cm_kwiml.h\"", public ] },
- { include: [ "\"KWIML/include/kwiml/int.h\"", private, "\"cm_kwiml.h\"", public ] },
- { include: [ "\"cmzlib/cm_zlib_mangle.h\"", private, "\"cm_zlib.h\"", public ] },
- { include: [ "\"cmzlib/zconf.h\"", private, "\"cm_zlib.h\"", public ] },
- { include: [ "\"cmzlib/zlib.h\"", private, "\"cm_zlib.h\"", public ] },
-
- # System symbols used by libuv
- { symbol: [ "SIGHUP", private, "\"cm_uv.h\"", public ] },
- { symbol: [ "SIGINT", private, "\"cm_uv.h\"", public ] },
- { symbol: [ "ssize_t", private, "\"cm_uv.h\"", public ] },
-
- { symbol: [ "Json::ArrayIndex", private, "\"cm_jsoncpp_value.h\"", public ] },
+ # Wrappers for 3rd-party libraries
+ { include: [ "@<.*curl/curlver.h>", private, "<cm3p/curl/curl.h>", public ] },
+ { include: [ "@<.*json/forwards.h>", private, "<cm3p/json/value.h>", public ] },
+ { include: [ "@<.*uv/.+\\.h>", private, "<cm3p/uv.h>", public ] },
+ { include: [ "@<.*expat_external.h>", private, "<cm3p/expat.h>", public ] },
+ { include: [ "@<.*zconf.h>", private, "<cm3p/zlib.h>", public ] },
+ { include: [ "@<.*cm_zlib_mangle.h>", private, "<cm3p/zlib.h>", public ] },
+ # # System symbols used by libuv
+ { symbol: [ "ssize_t", private, "<cm3p/uv.h>", public ] },
{ symbol: [ "std::ifstream", private, "\"cmsys/FStream.hxx\"", public ] },
{ symbol: [ "std::ofstream", private, "\"cmsys/FStream.hxx\"", public ] },
@@ -156,8 +117,6 @@
{ include: [ "<fstream>", public, "\"cmsys/FStream.hxx\"", public ] },
# major and minor are used as macro arguments. Those are false matches.
- { symbol: [ "major", private, "\"cm_kwiml.h\"", public ] },
- { symbol: [ "minor", private, "\"cm_kwiml.h\"", public ] },
{ symbol: [ "major", private, "\"cmVersion.h\"", public ] },
{ symbol: [ "minor", private, "\"cmVersion.h\"", public ] },
diff --git a/Utilities/Release/.gitattributes b/Utilities/Release/.gitattributes
new file mode 100644
index 0000000..24e115f
--- /dev/null
+++ b/Utilities/Release/.gitattributes
@@ -0,0 +1 @@
+*.patch -whitespace
diff --git a/Utilities/Release/README.rst b/Utilities/Release/README.rst
index de294d1..9993afa 100644
--- a/Utilities/Release/README.rst
+++ b/Utilities/Release/README.rst
@@ -9,49 +9,57 @@ on ``cmake.org``. See also the `CMake Source Code Guide`_.
Docker
------
-The ``linux/<arch>/`` directories contain Docker specifications that anyone
-may use to produce Linux binaries for CMake:
+The ``<os>/<arch>/`` directories contain Docker specifications that anyone
+may use to produce binaries for CMake on the following platforms:
-* ``linux/<arch>/base/Dockerfile``:
+* ``linux/x86_64/``: Linux on ``x86_64`` architectures.
+* ``win/x86/``: Windows on ``x86_64`` and ``i386`` architectures.
+
+Each ``<os>/<arch>/`` directory contains the following:
+
+* ``<os>/<arch>/base/Dockerfile``:
Produces a base image with a build environment for portable CMake binaries.
This image is published in the `kitware/cmake Docker Hub Repository`_
- with tag ``build-linux-<arch>-base-<date>``.
+ with tag ``build-<os>-<arch>-base-<date>``.
-* ``linux/<arch>/deps/Dockerfile``:
+* ``<os>/<arch>/deps/Dockerfile``:
Produces an image with custom-built dependencies for portable CMake binaries.
This image is published in the `kitware/cmake Docker Hub Repository`_
- with tag ``build-linux-<arch>-deps-<date>``.
+ with tag ``build-<os>-<arch>-deps-<date>``.
-* ``linux/<arch>/Dockerfile``:
- Produce an image containing a portable CMake binary package for Linux.
+* ``<os>/<arch>/Dockerfile``:
+ Produce an image containing a portable CMake binary package.
Build this image using the CMake source directory as the build context.
- The resulting image will have an ``/out`` directory containing the package.
- For example:
+ The resulting image will have an ``/out`` (or ``c:/out``) directory
+ containing the package. For example, on Linux ``x86_64``:
.. code-block:: console
$ docker build --tag=cmake:build --network none \
- -f cmake-src/Utilities/Release/linux/$arch/Dockerfile cmake-src
+ -f cmake-src/Utilities/Release/linux/x86_64/Dockerfile cmake-src
$ docker container create --name cmake-build cmake:build
$ docker cp cmake-build:/out .
- $ ls out/cmake-*-Linux-$arch.*
+ $ ls out/cmake-*-Linux-x86_64.*
-* ``linux/<arch>/test/Dockerfile``:
+ On Windows, the ``win/x86`` specifications support both the ``x86_64``
+ and ``i386`` architectures selected via ``--build-arg ARCH=...``.
+
+* ``<os>/<arch>/test/Dockerfile``:
Produces a base image with a test environment for packaged CMake binaries.
- For example, build the test base image:
+ For example, on Linux ``x86_64``, one may build the test base image:
.. code-block:: console
$ docker build --tag=cmake:test-base \
- cmake-src/Utilities/Release/linux/$arch/test
+ cmake-src/Utilities/Release/linux/x86_64/test
Then create a local ``test/Dockerfile`` to prepare an image with both the
CMake source tree and the above-built package::
FROM cmake:test-base
COPY cmake-src /opt/cmake/src/cmake
- ADD out/cmake-<ver>-Linux-<arch>.tar.gz /opt/
- ENV PATH=/opt/cmake-<ver>-Linux-<arch>/bin:$PATH
+ ADD out/cmake-<ver>-Linux-x86_64.tar.gz /opt/
+ ENV PATH=/opt/cmake-<ver>-Linux-x86_64/bin:$PATH
Build the test image and run it to drive testing:
@@ -61,6 +69,10 @@ may use to produce Linux binaries for CMake:
$ docker run --network none cmake:test bash test-make.bash
$ docker run --network none cmake:test bash test-ninja.bash
+ On Windows, the test scripts are called ``test-nmake.bat`` and
+ ``test-ninja.bat``. In the ``x86`` architecture they accept one
+ argument specifying either ``x86_64`` or ``i386``.
+
.. _`kitware/cmake Docker Hub Repository`: https://hub.docker.com/r/kitware/cmake
Scripts for Kitware
diff --git a/Utilities/Release/create-cmake-release.cmake b/Utilities/Release/create-cmake-release.cmake
index 17a2151..88ac826 100644
--- a/Utilities/Release/create-cmake-release.cmake
+++ b/Utilities/Release/create-cmake-release.cmake
@@ -46,13 +46,9 @@ endfunction()
write_docs_shell_script("create-${CMAKE_CREATE_VERSION}-docs.sh")
write_rel_shell_script("create-${CMAKE_CREATE_VERSION}-macos.sh" osx_release ) # macOS x86_64
-write_rel_shell_script("create-${CMAKE_CREATE_VERSION}-win64.sh" win64_release ) # Windows x64
-write_rel_shell_script("create-${CMAKE_CREATE_VERSION}-win32.sh" win32_release ) # Windows x86
message("Build docs first and then build for each platform:
./create-${CMAKE_CREATE_VERSION}-docs.sh &&
./create-${CMAKE_CREATE_VERSION}-macos.sh &&
- ./create-${CMAKE_CREATE_VERSION}-win64.sh &&
- ./create-${CMAKE_CREATE_VERSION}-win32.sh &&
echo done
")
diff --git a/Utilities/Release/linux/x86_64/test/cache-ninja.txt b/Utilities/Release/linux/x86_64/test/cache-ninja.txt
deleted file mode 100644
index b00370e..0000000
--- a/Utilities/Release/linux/x86_64/test/cache-ninja.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-CMAKE_Fortran_COMPILER:STRING=
-CMake_TEST_IPO_WORKS_C:BOOL=ON
-CMake_TEST_IPO_WORKS_CXX:BOOL=ON
-CMake_TEST_Qt5:BOOL=ON
diff --git a/Utilities/Release/win/x86/Dockerfile b/Utilities/Release/win/x86/Dockerfile
new file mode 100644
index 0000000..a4f7445
--- /dev/null
+++ b/Utilities/Release/win/x86/Dockerfile
@@ -0,0 +1,23 @@
+# escape=`
+
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+# Produce an image containing a portable CMake binary package for Windows.
+# Build using the CMake source directory as the build context.
+# The resulting image will have a 'c:\out' directory containing the package.
+
+ARG FROM_IMAGE_NAME=kitware/cmake:build-win-x86-deps-2020-04-27
+ARG FROM_IMAGE_DIGEST=@sha256:04e229c0c0ba2247855d0e8c0fb87c1686f983adbafa4ce413e61b3905edb76b
+ARG FROM_IMAGE=$FROM_IMAGE_NAME$FROM_IMAGE_DIGEST
+
+FROM $FROM_IMAGE as build
+COPY . C:\cmake\src\cmake
+ARG ARCH="x86_64"
+ARG TEST="true"
+RUN \cmake\src\cmake\Utilities\Release\win\x86\build.bat %ARCH% %TEST%
+
+# Package in a separate stage so the builder can optionally skip it.
+FROM build as pack
+ARG PACK="ZIP WIX"
+RUN \cmake\src\cmake\Utilities\Release\win\x86\pack.bat %PACK%
diff --git a/Utilities/Release/win/x86/base/Dockerfile b/Utilities/Release/win/x86/base/Dockerfile
new file mode 100644
index 0000000..c2c00f8
--- /dev/null
+++ b/Utilities/Release/win/x86/base/Dockerfile
@@ -0,0 +1,30 @@
+# escape=`
+
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+# Produce a base image with a build environment for portable CMake binaries.
+# Build using the directory containing this file as its own build context.
+
+ARG FROM_IMAGE_NAME=mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019
+ARG FROM_IMAGE_DIGEST=@sha256:a94289bfd61ba89cd162f7cf84afe0e307d4d2576b44b9bd277e7b3036ccfa6b
+ARG FROM_IMAGE=$FROM_IMAGE_NAME$FROM_IMAGE_DIGEST
+FROM $FROM_IMAGE
+
+# Use a traditional Windows shell.
+SHELL ["cmd", "/S", "/C"]
+
+# Install Visual Studio Build Tools for desktop development with C++.
+ADD https://aka.ms/vs/16/release/vs_buildtools.exe C:\TEMP\vs_buildtools.exe
+RUN C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache `
+ --installPath C:\BuildTools `
+ --add Microsoft.VisualStudio.Workload.VCTools `
+ --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
+ --add Microsoft.VisualStudio.Component.VC.CLI.Support `
+ --add Microsoft.VisualStudio.Component.VC.ATL `
+ --add Microsoft.VisualStudio.Component.Windows10SDK.18362 `
+ || IF "%ERRORLEVEL%"=="3010" EXIT 0
+RUN del C:\TEMP\vs_buildtools.exe
+
+# Add a toolchain environment loader for each architecture.
+COPY msvc-x86_64.bat msvc-i386.bat C:\
diff --git a/Utilities/Release/win/x86/base/msvc-i386.bat b/Utilities/Release/win/x86/base/msvc-i386.bat
new file mode 100755
index 0000000..a63bdd2
--- /dev/null
+++ b/Utilities/Release/win/x86/base/msvc-i386.bat
@@ -0,0 +1 @@
+@C:\BuildTools\VC\Auxiliary\Build\vcvarsall.bat x86
diff --git a/Utilities/Release/win/x86/base/msvc-x86_64.bat b/Utilities/Release/win/x86/base/msvc-x86_64.bat
new file mode 100755
index 0000000..cffe0e7
--- /dev/null
+++ b/Utilities/Release/win/x86/base/msvc-x86_64.bat
@@ -0,0 +1 @@
+@C:\BuildTools\VC\Auxiliary\Build\vcvarsall.bat x64
diff --git a/Utilities/Release/win/x86/build.bat b/Utilities/Release/win/x86/build.bat
new file mode 100755
index 0000000..2125572
--- /dev/null
+++ b/Utilities/Release/win/x86/build.bat
@@ -0,0 +1,19 @@
+@rem Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+@rem file Copyright.txt or https://cmake.org/licensing for details.
+
+set ARCH=%1
+set TEST=%2
+
+copy \msvc-%ARCH%.bat \msvc.bat
+call \msvc.bat && @echo on || exit /b
+set PATH=C:\ninja;%PATH%
+
+mkdir \cmake\src\cmake-build && ^
+cd \cmake\src\cmake-build && ^
+copy ..\cmake\Utilities\Release\win\x86\cache-%ARCH%.txt CMakeCache.txt && ^
+\cmake\cmake\bin\cmake ..\cmake -GNinja && ^
+ninja && (
+ if "%TEST%"=="true" (
+ bin\ctest --output-on-failure -j %NUMBER_OF_PROCESSORS% -R "^(CMake\.|CMakeLib\.|CMakeServerLib\.|RunCMake\.ctest_memcheck)"
+ )
+)
diff --git a/Utilities/Release/win/x86/cache-i386.txt b/Utilities/Release/win/x86/cache-i386.txt
new file mode 100644
index 0000000..3c0ecc7
--- /dev/null
+++ b/Utilities/Release/win/x86/cache-i386.txt
@@ -0,0 +1,45 @@
+CMAKE_BUILD_TYPE:STRING=Release
+
+# Use APIs from at most Windows 7
+CMAKE_C_FLAGS:STRING=-D_WIN32_WINNT=0x601 -DNTDDI_VERSION=0x06010000
+CMAKE_CXX_FLAGS:STRING=-GR -EHsc -D_WIN32_WINNT=0x601 -DNTDDI_VERSION=0x06010000
+CMAKE_EXE_LINKER_FLAGS:STRING=-machine:x86 -subsystem:console,6.01
+
+# Link C/C++ runtime library statically.
+CMAKE_MSVC_RUNTIME_LIBRARY:STRING=MultiThreaded$<$<CONFIG:Debug>:Debug>
+
+# No ssl support in curl: use native Windows APIs.
+CMAKE_USE_OPENSSL:BOOL=OFF
+
+# Enable cmake-gui with static qt plugins
+BUILD_QtDialog:BOOL=TRUE
+CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3
+CMAKE_PREFIX_PATH:STRING=C:/qt-i386
+CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES:STRING=c:/qt-i386/plugins/platforms/qwindows.lib;c:/qt-i386/plugins/styles/qwindowsvistastyle.lib;c:/qt-i386/lib/Qt5EventDispatcherSupport.lib;c:/qt-i386/lib/Qt5FontDatabaseSupport.lib;c:/qt-i386/lib/Qt5ThemeSupport.lib;c:/qt-i386/lib/qtfreetype.lib;c:/qt-i386/lib/qtlibpng.lib;imm32.lib;wtsapi32.lib
+
+# Build documentation.
+CMAKE_DOC_DIR:STRING=doc/cmake
+PYTHON_EXECUTABLE:FILEPATH=C:/python3/python.exe
+SPHINX_EXECUTABLE:FILEPATH=C:/python3/Scripts/sphinx-build.exe
+SPHINX_HTML:BOOL=ON
+SPHINX_MAN:BOOL=ON
+SPHINX_QTHELP:BOOL=ON
+QCOLLECTIONGENERATOR_EXECUTABLE:PATH=C:/qt-i386/bin/qhelpgenerator.exe
+
+# No bootstrap with MSVC tools.
+CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE
+
+# No MFC in base image.
+CTEST_RUN_MFC:BOOL=OFF
+
+# No Fortran compiler.
+CMAKE_Fortran_COMPILER:FILEPATH=FALSE
+
+# No Swift compiler.
+CMAKE_Swift_COMPILER:FILEPATH=FALSE
+
+# Skip Qt5 tests because our Qt is static.
+CMake_TEST_Qt5:BOOL=FALSE
+
+# CPack package file name component for this platform.
+CPACK_SYSTEM_NAME:STRING=win32-x86
diff --git a/Utilities/Release/win/x86/cache-x86_64.txt b/Utilities/Release/win/x86/cache-x86_64.txt
new file mode 100644
index 0000000..2ccf93b
--- /dev/null
+++ b/Utilities/Release/win/x86/cache-x86_64.txt
@@ -0,0 +1,45 @@
+CMAKE_BUILD_TYPE:STRING=Release
+
+# Use APIs from at most Windows 7
+CMAKE_C_FLAGS:STRING=-D_WIN32_WINNT=0x601 -DNTDDI_VERSION=0x06010000
+CMAKE_CXX_FLAGS:STRING=-GR -EHsc -D_WIN32_WINNT=0x601 -DNTDDI_VERSION=0x06010000
+CMAKE_EXE_LINKER_FLAGS:STRING=-machine:x64 -subsystem:console,6.01
+
+# Link C/C++ runtime library statically.
+CMAKE_MSVC_RUNTIME_LIBRARY:STRING=MultiThreaded$<$<CONFIG:Debug>:Debug>
+
+# No ssl support in curl: use native Windows APIs.
+CMAKE_USE_OPENSSL:BOOL=OFF
+
+# Enable cmake-gui with static qt plugins
+BUILD_QtDialog:BOOL=TRUE
+CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3
+CMAKE_PREFIX_PATH:STRING=C:/qt-x86_64
+CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES:STRING=c:/qt-x86_64/plugins/platforms/qwindows.lib;c:/qt-x86_64/plugins/styles/qwindowsvistastyle.lib;c:/qt-x86_64/lib/Qt5EventDispatcherSupport.lib;c:/qt-x86_64/lib/Qt5FontDatabaseSupport.lib;c:/qt-x86_64/lib/Qt5ThemeSupport.lib;c:/qt-x86_64/lib/qtfreetype.lib;c:/qt-x86_64/lib/qtlibpng.lib;imm32.lib;wtsapi32.lib
+
+# Build documentation.
+CMAKE_DOC_DIR:STRING=doc/cmake
+PYTHON_EXECUTABLE:FILEPATH=C:/python3/python.exe
+SPHINX_EXECUTABLE:FILEPATH=C:/python3/Scripts/sphinx-build.exe
+SPHINX_HTML:BOOL=ON
+SPHINX_MAN:BOOL=ON
+SPHINX_QTHELP:BOOL=ON
+QCOLLECTIONGENERATOR_EXECUTABLE:PATH=C:/qt-x86_64/bin/qhelpgenerator.exe
+
+# No bootstrap with MSVC tools.
+CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE
+
+# No MFC in base image.
+CTEST_RUN_MFC:BOOL=OFF
+
+# No Fortran compiler.
+CMAKE_Fortran_COMPILER:FILEPATH=FALSE
+
+# No Swift compiler.
+CMAKE_Swift_COMPILER:FILEPATH=FALSE
+
+# Skip Qt5 tests because our Qt is static.
+CMake_TEST_Qt5:BOOL=FALSE
+
+# CPack package file name component for this platform.
+CPACK_SYSTEM_NAME:STRING=win64-x64
diff --git a/Utilities/Release/win/x86/deps/Dockerfile b/Utilities/Release/win/x86/deps/Dockerfile
new file mode 100644
index 0000000..4b294c1
--- /dev/null
+++ b/Utilities/Release/win/x86/deps/Dockerfile
@@ -0,0 +1,127 @@
+# escape=`
+
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+# Produce an image with custom-built dependencies for portable CMake binaries.
+# Build using the directory containing this file as its own build context.
+
+ARG FROM_IMAGE_NAME=kitware/cmake:build-win-x86-base-2020-04-27
+ARG FROM_IMAGE_DIGEST=@sha256:c5a8948d636319cdac0180266996558bb6fb037125792b5b837f069d02e53d7c
+ARG FROM_IMAGE=$FROM_IMAGE_NAME$FROM_IMAGE_DIGEST
+
+# Qt Source
+FROM $FROM_IMAGE AS qt-src
+
+# JOM
+ADD http://download.qt-project.org/official_releases/jom/unstable-jom.zip C:\jom\jom.zip
+RUN cd \jom `
+ && powershell -Command " `
+ if ($(Get-FileHash jom.zip).Hash -eq '128fdd846fe24f8594eed37d1d8929a0ea78df563537c0c1b1861a635013fff8') {`
+ Expand-Archive -Path jom.zip -DestinationPath .`
+ } else {`
+ exit 1 `
+ }" `
+ && del jom.zip
+
+# XZ
+ADD https://tukaani.org/xz/xz-5.2.5-windows.zip C:\xz\xz.zip
+RUN cd \xz `
+ && powershell -Command " `
+ if ($(Get-FileHash xz.zip).Hash -eq 'd83b82ca75dfab39a13dda364367b34970c781a9df4d41264db922ac3a8f622d') {`
+ Expand-Archive -Path xz.zip -DestinationPath .`
+ } else {`
+ exit 1 `
+ }" `
+ && del xz.zip
+
+# Git
+ADD https://github.com/git-for-windows/git/releases/download/v2.26.2.windows.1/MinGit-2.26.2-busybox-64-bit.zip C:\git\git.zip
+RUN cd \git `
+ && powershell -Command " `
+ if ($(Get-FileHash git.zip).Hash -eq 'e834ea73fe093fb180dc45f67a1f2a7a566dab53d1d45bc3cd150106f5c40520') {`
+ Expand-Archive -Path git.zip -DestinationPath .`
+ } else {`
+ exit 1 `
+ }" `
+ && del git.zip
+
+# Qt Source
+ADD https://download.qt.io/official_releases/qt/5.12/5.12.1/single/qt-everywhere-src-5.12.1.tar.xz C:\qt-src\qt.tar.xz
+RUN cd \qt-src `
+ && powershell -Command " `
+ if ($(Get-FileHash qt.tar.xz).Hash -eq 'caffbd625c7bc10ff8c5c7a27dbc7d84fa4de146975c0e1ffe904b514ccd6da4') {`
+ \xz\bin_x86-64\xz -d qt.tar.xz `
+ } else {`
+ exit 1 `
+ }" `
+ && tar xvf qt.tar `
+ && del qt.tar `
+ && move qt-everywhere-src-5.12.1 qt
+COPY qt-build.bat qt-install.patch C:\qt-src\
+
+# Qt Build i386
+FROM qt-src as qt-i386
+RUN \qt-src\qt-build.bat i386
+
+# Qt Build x86_64
+FROM qt-src as qt-x86_64
+RUN \qt-src\qt-build.bat x86_64
+
+# Output Stage
+FROM $FROM_IMAGE
+
+# Qt
+COPY --from=qt-i386 C:\qt-i386 C:\qt-i386
+COPY --from=qt-x86_64 C:\qt-x86_64 C:\qt-x86_64
+
+# WIX
+ADD https://github.com/wixtoolset/wix3/releases/download/wix3112rtm/wix311-binaries.zip C:\wix\wix.zip
+RUN cd \wix `
+ && powershell -Command " `
+ if ($(Get-FileHash wix.zip).Hash -eq '2c1888d5d1dba377fc7fa14444cf556963747ff9a0a289a3599cf09da03b9e2e') {`
+ Expand-Archive -Path wix.zip -DestinationPath .`
+ } else {`
+ exit 1 `
+ }" `
+ && del wix.zip
+
+# Python and Sphinx
+ADD https://www.python.org/ftp/python/3.8.2/python-3.8.2-embed-amd64.zip C:\python3\python3.zip
+RUN cd \python3 `
+ && powershell -Command " `
+ if ($(Get-FileHash python3.zip).Hash -eq '2927a3a6d0fe1f6e047a86059220aeda374eed23113b9ef5355acb8452d56453') {`
+ Expand-Archive -Path python3.zip -DestinationPath .`
+ } else {`
+ exit 1 `
+ }" `
+ && del python3.zip `
+ && curl -O https://bootstrap.pypa.io/get-pip.py `
+ && python get-pip.py `
+ && del python38._pth `
+ && set "PY_LIBS=C:\python3\Lib;C:\Python3\Lib\site-packages" `
+ && set "PY_PIP=C:\python3\Scripts" `
+ && Scripts\pip install --no-warn-script-location sphinx==2.1.2
+
+# Ninja
+ADD https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-win.zip C:\ninja\ninja.zip
+RUN cd \ninja `
+ && powershell -Command " `
+ if ($(Get-FileHash ninja.zip).Hash -eq '919fd158c16bf135e8a850bb4046ec1ce28a7439ee08b977cd0b7f6b3463d178') {`
+ Expand-Archive -Path ninja.zip -DestinationPath .`
+ } else {`
+ exit 1 `
+ }" `
+ && del ninja.zip
+
+# CMake
+ADD https://github.com/Kitware/CMake/releases/download/v3.17.1/cmake-3.17.1-win64-x64.zip C:\cmake\cmake.zip
+RUN cd \cmake `
+ && powershell -Command " `
+ if ($(Get-FileHash cmake.zip).Hash -eq 'a5af7a2fe73f34070456397e940042e4469f072126c82974f44333ac43d478b1') {`
+ Expand-Archive -Path cmake.zip -DestinationPath .`
+ } else {`
+ exit 1 `
+ }" `
+ && move cmake-*-win64-x64 cmake `
+ && del cmake.zip
diff --git a/Utilities/Release/win/x86/deps/qt-build.bat b/Utilities/Release/win/x86/deps/qt-build.bat
new file mode 100755
index 0000000..e8bfa81
--- /dev/null
+++ b/Utilities/Release/win/x86/deps/qt-build.bat
@@ -0,0 +1,47 @@
+set ARCH=%1
+call \msvc-%ARCH%.bat && @echo on || exit /b
+mkdir \qt-src\qt-build && ^
+cd \qt-src\qt-build && ^
+..\qt\configure.bat ^
+ -prefix C:/qt-%ARCH% ^
+ -static ^
+ -static-runtime ^
+ -release ^
+ -opensource -confirm-license ^
+ -platform win32-msvc ^
+ -mp ^
+ -gui ^
+ -widgets ^
+ -qt-pcre ^
+ -qt-zlib ^
+ -qt-libpng ^
+ -qt-libjpeg ^
+ -no-gif ^
+ -no-icu ^
+ -no-pch ^
+ -no-angle ^
+ -no-opengl ^
+ -no-dbus ^
+ -no-harfbuzz ^
+ -no-accessibility ^
+ -skip declarative ^
+ -skip multimedia ^
+ -skip qtcanvas3d ^
+ -skip qtconnectivity ^
+ -skip qtdeclarative ^
+ -skip qtlocation ^
+ -skip qtmultimedia ^
+ -skip qtsensors ^
+ -skip qtserialport ^
+ -skip qtsvg ^
+ -skip qtwayland ^
+ -skip qtwebchannel ^
+ -skip qtwebengine ^
+ -skip qtwebsockets ^
+ -skip qtxmlpatterns ^
+ -nomake examples -nomake tests ^
+ && ^
+\jom\jom.exe -J %NUMBER_OF_PROCESSORS% && ^
+\jom\jom.exe install && ^
+cd \qt-%ARCH% && ^
+\git\cmd\git apply \qt-src\qt-install.patch
diff --git a/Utilities/Release/win/x86/deps/qt-install.patch b/Utilities/Release/win/x86/deps/qt-install.patch
new file mode 100644
index 0000000..39a649e
--- /dev/null
+++ b/Utilities/Release/win/x86/deps/qt-install.patch
@@ -0,0 +1,26 @@
+diff --git a/lib/cmake/Qt5Core/Qt5CoreConfig.cmake b/lib/cmake/Qt5Core/Qt5CoreConfig.cmake
+index 04ec302..75d5596 100644
+--- a/lib/cmake/Qt5Core/Qt5CoreConfig.cmake
++++ b/lib/cmake/Qt5Core/Qt5CoreConfig.cmake
+@@ -118,7 +118,7 @@ if (NOT TARGET Qt5::Core)
+ list(REMOVE_DUPLICATES Qt5Core_COMPILE_DEFINITIONS)
+ list(REMOVE_DUPLICATES Qt5Core_EXECUTABLE_COMPILE_FLAGS)
+
+- set(_Qt5Core_LIB_DEPENDENCIES "")
++ set(_Qt5Core_LIB_DEPENDENCIES "${_qt5Core_install_prefix}/lib/qtpcre2.lib;netapi32.lib;version.lib")
+
+
+ add_library(Qt5::Core STATIC IMPORTED)
+diff --git a/lib/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake b/lib/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake
+index a07b953..2e07371 100644
+--- a/lib/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake
++++ b/lib/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake
+@@ -118,7 +118,7 @@ if (NOT TARGET Qt5::Widgets)
+ list(REMOVE_DUPLICATES Qt5Widgets_COMPILE_DEFINITIONS)
+ list(REMOVE_DUPLICATES Qt5Widgets_EXECUTABLE_COMPILE_FLAGS)
+
+- set(_Qt5Widgets_LIB_DEPENDENCIES "Qt5::Gui;Qt5::Core")
++ set(_Qt5Widgets_LIB_DEPENDENCIES "Qt5::Gui;Qt5::Core;dwmapi.lib;uxtheme.lib")
+
+
+ add_library(Qt5::Widgets STATIC IMPORTED)
diff --git a/Utilities/Release/win/x86/pack.bat b/Utilities/Release/win/x86/pack.bat
new file mode 100755
index 0000000..2d37eef
--- /dev/null
+++ b/Utilities/Release/win/x86/pack.bat
@@ -0,0 +1,12 @@
+@rem Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+@rem file Copyright.txt or https://cmake.org/licensing for details.
+
+call \msvc.bat && @echo on || exit /b
+set PATH=C:\wix;C:\ninja;%PATH%
+cd \cmake\src\cmake-build && (
+ for %%p in (%*) do (
+ bin\cpack -G %%p
+ )
+) && ^
+mkdir \out && ^
+move cmake-*-win* \out
diff --git a/Utilities/Release/win/x86/test/Dockerfile b/Utilities/Release/win/x86/test/Dockerfile
new file mode 100644
index 0000000..15bcd37
--- /dev/null
+++ b/Utilities/Release/win/x86/test/Dockerfile
@@ -0,0 +1,37 @@
+# escape=`
+
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+# Produce a base image with a test environment for packaged CMake binaries.
+# Build using the directory containing this file as its own build context.
+
+ARG FROM_IMAGE_NAME=kitware/cmake:build-win-x86-base-2020-04-27
+ARG FROM_IMAGE_DIGEST=@sha256:c5a8948d636319cdac0180266996558bb6fb037125792b5b837f069d02e53d7c
+ARG FROM_IMAGE=$FROM_IMAGE_NAME$FROM_IMAGE_DIGEST
+FROM $FROM_IMAGE
+
+# Python
+ADD https://www.python.org/ftp/python/3.8.2/python-3.8.2-embed-amd64.zip C:\python3\python3.zip
+RUN cd \python3 `
+ && powershell -Command " `
+ if ($(Get-FileHash python3.zip).Hash -eq '2927a3a6d0fe1f6e047a86059220aeda374eed23113b9ef5355acb8452d56453') {`
+ Expand-Archive -Path python3.zip -DestinationPath .`
+ } else {`
+ exit 1 `
+ }" `
+ && del python3.zip `
+ && del python38._pth
+
+# Ninja
+ADD https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-win.zip C:\ninja\ninja.zip
+RUN cd \ninja `
+ && powershell -Command " `
+ if ($(Get-FileHash ninja.zip).Hash -eq '919fd158c16bf135e8a850bb4046ec1ce28a7439ee08b977cd0b7f6b3463d178') {`
+ Expand-Archive -Path ninja.zip -DestinationPath .`
+ } else {`
+ exit 1 `
+ }" `
+ && del ninja.zip
+
+COPY test-nmake.bat test-ninja.bat C:\
diff --git a/Utilities/Release/win/x86/test/test-ninja.bat b/Utilities/Release/win/x86/test/test-ninja.bat
new file mode 100755
index 0000000..b8347ef
--- /dev/null
+++ b/Utilities/Release/win/x86/test/test-ninja.bat
@@ -0,0 +1,19 @@
+@rem Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+@rem file Copyright.txt or https://cmake.org/licensing for details.
+
+set ARCH=%1
+call \msvc-%ARCH%.bat && @echo on || exit /b
+set "PATH=C:\cmake\cmake\bin;C:\ninja;C:\python3;%PATH%"
+mkdir \cmake\src\cmake-ninja && ^
+cd \cmake\src\cmake-ninja && ^
+> CMakeCache.txt (
+ @echo CMAKE_Fortran_COMPILER:STRING=
+ @echo CMAKE_Swift_COMPILER:STRING=
+ @echo CMake_TEST_IPO_WORKS_C:BOOL=ON
+ @echo CMake_TEST_IPO_WORKS_CXX:BOOL=ON
+ @echo CMake_TEST_NO_NETWORK:BOOL=ON
+ @echo CTEST_RUN_MFC:BOOL=OFF
+) && ^
+cmake ..\cmake -DCMake_TEST_HOST_CMAKE=1 -G "Ninja" && ^
+ninja && ^
+ctest --output-on-failure -j %NUMBER_OF_PROCESSORS%
diff --git a/Utilities/Release/win/x86/test/test-nmake.bat b/Utilities/Release/win/x86/test/test-nmake.bat
new file mode 100755
index 0000000..5008711
--- /dev/null
+++ b/Utilities/Release/win/x86/test/test-nmake.bat
@@ -0,0 +1,19 @@
+@rem Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+@rem file Copyright.txt or https://cmake.org/licensing for details.
+
+set ARCH=%1
+call \msvc-%ARCH%.bat && @echo on || exit /b
+set "PATH=C:\cmake\cmake\bin;C:\python3;%PATH%"
+mkdir \cmake\src\cmake-nmake && ^
+cd \cmake\src\cmake-nmake && ^
+> CMakeCache.txt (
+ @echo CMAKE_Fortran_COMPILER:STRING=
+ @echo CMAKE_Swift_COMPILER:STRING=
+ @echo CMake_TEST_IPO_WORKS_C:BOOL=ON
+ @echo CMake_TEST_IPO_WORKS_CXX:BOOL=ON
+ @echo CMake_TEST_NO_NETWORK:BOOL=ON
+ @echo CTEST_RUN_MFC:BOOL=OFF
+) && ^
+cmake ..\cmake -DCMake_TEST_HOST_CMAKE=1 -G "NMake Makefiles" && ^
+nmake && ^
+ctest --output-on-failure -j %NUMBER_OF_PROCESSORS%
diff --git a/Utilities/Release/win32_release.cmake b/Utilities/Release/win32_release.cmake
deleted file mode 100644
index 993db6e..0000000
--- a/Utilities/Release/win32_release.cmake
+++ /dev/null
@@ -1,53 +0,0 @@
-set(CMAKE_RELEASE_DIRECTORY "c:/msys64/home/dashboard/CMakeReleaseDirectory32")
-set(CONFIGURE_WITH_CMAKE TRUE)
-set(CMAKE_CONFIGURE_PATH "c:/Program\\ Files/CMake/bin/cmake.exe")
-set(PROCESSORS 16)
-set(HOST win32)
-set(RUN_LAUNCHER ~/rel/run)
-set(CPACK_BINARY_GENERATORS "WIX ZIP")
-set(CPACK_SOURCE_GENERATORS "")
-set(MAKE_PROGRAM "ninja")
-set(MAKE "${MAKE_PROGRAM} -j16")
-set(qt_prefix "c:/Qt/5.12.1/msvc2017-32-w7-mt")
-set(qt_win_libs
- ${qt_prefix}/plugins/platforms/qwindows.lib
- ${qt_prefix}/plugins/styles/qwindowsvistastyle.lib
- ${qt_prefix}/lib/Qt5EventDispatcherSupport.lib
- ${qt_prefix}/lib/Qt5FontDatabaseSupport.lib
- ${qt_prefix}/lib/Qt5ThemeSupport.lib
- ${qt_prefix}/lib/qtfreetype.lib
- ${qt_prefix}/lib/qtlibpng.lib
- imm32.lib
- wtsapi32.lib
- )
-set(INITIAL_CACHE "CMAKE_BUILD_TYPE:STRING=Release
-CMAKE_DOC_DIR:STRING=doc/cmake
-CMAKE_USE_OPENSSL:BOOL=OFF
-CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE
-CMAKE_Fortran_COMPILER:FILEPATH=FALSE
-CMAKE_GENERATOR:INTERNAL=Ninja
-BUILD_QtDialog:BOOL=TRUE
-CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3
-CMAKE_MSVC_RUNTIME_LIBRARY:STRING=MultiThreaded$<$<CONFIG:Debug>:Debug>
-CMAKE_EXE_LINKER_FLAGS:STRING=-machine:x86 -subsystem:console,6.01
-CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES:STRING=${qt_win_libs}
-CMAKE_PREFIX_PATH:STRING=${qt_prefix}
-CMake_TEST_Qt4:BOOL=OFF
-CMake_TEST_Qt5:BOOL=OFF
-PYTHON_EXECUTABLE:FILEPATH=C:/Python/3.8-64/python.exe
-")
-set(ppflags "-D_WIN32_WINNT=0x601 -DNTDDI_VERSION=0x06010000")
-set(CFLAGS "${ppflags}")
-set(CXXFLAGS "${ppflags}")
-set(ENV ". ~/rel/env32")
-get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH)
-set(GIT_EXTRA "git config core.autocrlf true")
-if(CMAKE_CREATE_VERSION STREQUAL "nightly")
- # Some tests fail spuriously too often.
- set(EXTRA_CTEST_ARGS "-E 'ConsoleBuf|Module.ExternalData'")
- set(SIGN "")
-else()
- string(APPEND INITIAL_CACHE "CMake_INSTALL_SIGNTOOL:STRING=signtool\n")
- set(SIGN [[signtool sign -v -a -tr http://timestamp.digicert.com -fd sha256 -td sha256 -d "CMake Windows Installer" cmake-*.msi]])
-endif()
-include(${path}/release_cmake.cmake)
diff --git a/Utilities/Release/win64_release.cmake b/Utilities/Release/win64_release.cmake
deleted file mode 100644
index 3042889..0000000
--- a/Utilities/Release/win64_release.cmake
+++ /dev/null
@@ -1,53 +0,0 @@
-set(CMAKE_RELEASE_DIRECTORY "c:/msys64/home/dashboard/CMakeReleaseDirectory64")
-set(CONFIGURE_WITH_CMAKE TRUE)
-set(CMAKE_CONFIGURE_PATH "c:/Program\\ Files/CMake/bin/cmake.exe")
-set(PROCESSORS 16)
-set(HOST win64)
-set(RUN_LAUNCHER ~/rel/run)
-set(CPACK_BINARY_GENERATORS "WIX ZIP")
-set(CPACK_SOURCE_GENERATORS "")
-set(MAKE_PROGRAM "ninja")
-set(MAKE "${MAKE_PROGRAM} -j16")
-set(qt_prefix "c:/Qt/5.12.1/msvc2017-64-w7-mt")
-set(qt_win_libs
- ${qt_prefix}/plugins/platforms/qwindows.lib
- ${qt_prefix}/plugins/styles/qwindowsvistastyle.lib
- ${qt_prefix}/lib/Qt5EventDispatcherSupport.lib
- ${qt_prefix}/lib/Qt5FontDatabaseSupport.lib
- ${qt_prefix}/lib/Qt5ThemeSupport.lib
- ${qt_prefix}/lib/qtfreetype.lib
- ${qt_prefix}/lib/qtlibpng.lib
- imm32.lib
- wtsapi32.lib
- )
-set(INITIAL_CACHE "CMAKE_BUILD_TYPE:STRING=Release
-CMAKE_DOC_DIR:STRING=doc/cmake
-CMAKE_USE_OPENSSL:BOOL=OFF
-CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE
-CMAKE_Fortran_COMPILER:FILEPATH=FALSE
-CMAKE_GENERATOR:INTERNAL=Ninja
-BUILD_QtDialog:BOOL=TRUE
-CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3
-CMAKE_MSVC_RUNTIME_LIBRARY:STRING=MultiThreaded$<$<CONFIG:Debug>:Debug>
-CMAKE_EXE_LINKER_FLAGS:STRING=-machine:x64 -subsystem:console,6.01
-CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES:STRING=${qt_win_libs}
-CMAKE_PREFIX_PATH:STRING=${qt_prefix}
-CMake_TEST_Qt4:BOOL=OFF
-CMake_TEST_Qt5:BOOL=OFF
-PYTHON_EXECUTABLE:FILEPATH=C:/Python/3.8-64/python.exe
-")
-set(ppflags "-D_WIN32_WINNT=0x601 -DNTDDI_VERSION=0x06010000")
-set(CFLAGS "${ppflags}")
-set(CXXFLAGS "${ppflags}")
-set(ENV ". ~/rel/env64")
-get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH)
-set(GIT_EXTRA "git config core.autocrlf true")
-if(CMAKE_CREATE_VERSION STREQUAL "nightly")
- # Some tests fail spuriously too often.
- set(EXTRA_CTEST_ARGS "-E 'ConsoleBuf|Module.ExternalData'")
- set(SIGN "")
-else()
- string(APPEND INITIAL_CACHE "CMake_INSTALL_SIGNTOOL:STRING=signtool\n")
- set(SIGN [[signtool sign -v -a -tr http://timestamp.digicert.com -fd sha256 -td sha256 -d "CMake Windows Installer" cmake-*.msi]])
-endif()
-include(${path}/release_cmake.cmake)
diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt
index 17c5018..e5be43a 100644
--- a/Utilities/Sphinx/CMakeLists.txt
+++ b/Utilities/Sphinx/CMakeLists.txt
@@ -89,7 +89,7 @@ if(SPHINX_QTHELP)
find_package(PythonInterp REQUIRED)
find_program(QCOLLECTIONGENERATOR_EXECUTABLE
- NAMES qcollectiongenerator
+ NAMES qcollectiongenerator-qt5 qcollectiongenerator
DOC "qcollectiongenerator tool"
)
if (NOT QCOLLECTIONGENERATOR_EXECUTABLE)
diff --git a/Utilities/Sphinx/CTestConfig.cmake b/Utilities/Sphinx/CTestConfig.cmake
new file mode 100644
index 0000000..9607e38
--- /dev/null
+++ b/Utilities/Sphinx/CTestConfig.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.
+
+# If changing this file, also update CTestConfig.cmake
+
+set(CTEST_PROJECT_NAME "CMake")
+set(CTEST_NIGHTLY_START_TIME "1:00:00 UTC")
+
+set(CTEST_DROP_METHOD "http")
+set(CTEST_DROP_SITE "open.cdash.org")
+set(CTEST_DROP_LOCATION "/submit.php?project=CMake")
+set(CTEST_DROP_SITE_CDASH TRUE)
+set(CTEST_CDASH_VERSION "1.6")
+set(CTEST_CDASH_QUERY_VERSION TRUE)
diff --git a/Utilities/cm3p/Setup.Configuration.h b/Utilities/cm3p/Setup.Configuration.h
new file mode 100644
index 0000000..a5cf058
--- /dev/null
+++ b/Utilities/cm3p/Setup.Configuration.h
@@ -0,0 +1,8 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#ifndef cm3p_Setup_Configuration_h
+#define cm3p_Setup_Configuration_h
+
+#include <cmvssetup/Setup.Configuration.h> // IWYU pragma: export
+
+#endif
diff --git a/Utilities/cm_libarchive.h b/Utilities/cm3p/archive.h
index ea8e9db..956b3ab 100644
--- a/Utilities/cm_libarchive.h
+++ b/Utilities/cm3p/archive.h
@@ -1,16 +1,14 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_libarchive_h
-#define cm_libarchive_h
+#ifndef cm3p_archive_h
+#define cm3p_archive_h
/* Use the libarchive configured for CMake. */
#include "cmThirdParty.h"
#ifdef CMAKE_USE_SYSTEM_LIBARCHIVE
-# include <archive.h>
-# include <archive_entry.h>
+# include <archive.h> // IWYU pragma: export
#else
-# include <cmlibarchive/libarchive/archive.h>
-# include <cmlibarchive/libarchive/archive_entry.h>
+# include <cmlibarchive/libarchive/archive.h> // IWYU pragma: export
#endif
#endif
diff --git a/Utilities/cm3p/archive_entry.h b/Utilities/cm3p/archive_entry.h
new file mode 100644
index 0000000..230e87a
--- /dev/null
+++ b/Utilities/cm3p/archive_entry.h
@@ -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. */
+#ifndef cm3p_archive_entry_h
+#define cm3p_archive_entry_h
+
+/* Use the libarchive configured for CMake. */
+#include "cmThirdParty.h"
+#ifdef CMAKE_USE_SYSTEM_LIBARCHIVE
+# include <archive_entry.h> // IWYU pragma: export
+#else
+# include <cmlibarchive/libarchive/archive_entry.h> // IWYU pragma: export
+#endif
+
+#endif
diff --git a/Utilities/cm_bzlib.h b/Utilities/cm3p/bzlib.h
index 8669e9e..2a0f4dd 100644
--- a/Utilities/cm_bzlib.h
+++ b/Utilities/cm3p/bzlib.h
@@ -1,14 +1,14 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_bzlib_h
-#define cm_bzlib_h
+#ifndef cm3p_bzlib_h
+#define cm3p_bzlib_h
/* Use the bzip2 library configured for CMake. */
#include "cmThirdParty.h"
#ifdef CMAKE_USE_SYSTEM_BZIP2
-# include <bzlib.h>
+# include <bzlib.h> // IWYU pragma: export
#else
-# include <cmbzip2/bzlib.h>
+# include <cmbzip2/bzlib.h> // IWYU pragma: export
#endif
#endif
diff --git a/Utilities/cm_curl.h b/Utilities/cm3p/curl/curl.h
index 673f8ad..6e2b822 100644
--- a/Utilities/cm_curl.h
+++ b/Utilities/cm3p/curl/curl.h
@@ -1,14 +1,14 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_curl_h
-#define cm_curl_h
+#ifndef cm3p_curl_curl_h
+#define cm3p_curl_curl_h
/* Use the curl library configured for CMake. */
#include "cmThirdParty.h"
#ifdef CMAKE_USE_SYSTEM_CURL
-# include <curl/curl.h>
+# include <curl/curl.h> // IWYU pragma: export
#else
-# include <cmcurl/include/curl/curl.h>
+# include <cmcurl/include/curl/curl.h> // IWYU pragma: export
#endif
#endif
diff --git a/Utilities/cm_expat.h b/Utilities/cm3p/expat.h
index fc5b39a..32e6fd0 100644
--- a/Utilities/cm_expat.h
+++ b/Utilities/cm3p/expat.h
@@ -1,14 +1,14 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_expat_h
-#define cm_expat_h
+#ifndef cm3p_expat_h
+#define cm3p_expat_h
/* Use the expat library configured for CMake. */
#include "cmThirdParty.h"
#ifdef CMAKE_USE_SYSTEM_EXPAT
-# include <expat.h>
+# include <expat.h> // IWYU pragma: export
#else
-# include <cmexpat/lib/expat.h>
+# include <cmexpat/lib/expat.h> // IWYU pragma: export
#endif
#endif
diff --git a/Utilities/cm_jsoncpp_writer.h b/Utilities/cm3p/json/reader.h
index d9e5d82..0df09ee 100644
--- a/Utilities/cm_jsoncpp_writer.h
+++ b/Utilities/cm3p/json/reader.h
@@ -1,14 +1,14 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_jsoncpp_writer_h
-#define cm_jsoncpp_writer_h
+#ifndef cm3p_json_reader_h
+#define cm3p_json_reader_h
/* Use the jsoncpp library configured for CMake. */
#include "cmThirdParty.h"
#ifdef CMAKE_USE_SYSTEM_JSONCPP
-# include <json/writer.h>
+# include <json/reader.h> // IWYU pragma: export
#else
-# include <cmjsoncpp/include/json/writer.h>
+# include <cmjsoncpp/include/json/reader.h> // IWYU pragma: export
#endif
#endif
diff --git a/Utilities/cm_jsoncpp_value.h b/Utilities/cm3p/json/value.h
index 742d99a..f59bed6 100644
--- a/Utilities/cm_jsoncpp_value.h
+++ b/Utilities/cm3p/json/value.h
@@ -1,14 +1,14 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_jsoncpp_value_h
-#define cm_jsoncpp_value_h
+#ifndef cm3p_json_value_h
+#define cm3p_json_value_h
/* Use the jsoncpp library configured for CMake. */
#include "cmThirdParty.h"
#ifdef CMAKE_USE_SYSTEM_JSONCPP
-# include <json/value.h>
+# include <json/value.h> // IWYU pragma: export
#else
-# include <cmjsoncpp/include/json/value.h>
+# include <cmjsoncpp/include/json/value.h> // IWYU pragma: export
#endif
#endif
diff --git a/Utilities/cm_jsoncpp_reader.h b/Utilities/cm3p/json/writer.h
index 23af65c..7fcc3e2 100644
--- a/Utilities/cm_jsoncpp_reader.h
+++ b/Utilities/cm3p/json/writer.h
@@ -1,14 +1,14 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_jsoncpp_reader_h
-#define cm_jsoncpp_reader_h
+#ifndef cm3p_json_writer_h
+#define cm3p_json_writer_h
/* Use the jsoncpp library configured for CMake. */
#include "cmThirdParty.h"
#ifdef CMAKE_USE_SYSTEM_JSONCPP
-# include <json/reader.h>
+# include <json/writer.h> // IWYU pragma: export
#else
-# include <cmjsoncpp/include/json/reader.h>
+# include <cmjsoncpp/include/json/writer.h> // IWYU pragma: export
#endif
#endif
diff --git a/Utilities/cm_kwiml.h b/Utilities/cm3p/kwiml/abi.h
index 566f67e..6d0dedf 100644
--- a/Utilities/cm_kwiml.h
+++ b/Utilities/cm3p/kwiml/abi.h
@@ -1,16 +1,14 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_kwiml_h
-#define cm_kwiml_h
+#ifndef cm3p_kwiml_abi_h
+#define cm3p_kwiml_abi_h
/* Use the KWIML library configured for CMake. */
#include "cmThirdParty.h"
#ifdef CMAKE_USE_SYSTEM_KWIML
-# include <kwiml/abi.h>
-# include <kwiml/int.h>
+# include <kwiml/abi.h> // IWYU pragma: export
#else
-# include "KWIML/include/kwiml/abi.h"
-# include "KWIML/include/kwiml/int.h"
+# include <KWIML/include/kwiml/abi.h> // IWYU pragma: export
#endif
#endif
diff --git a/Utilities/cm3p/kwiml/int.h b/Utilities/cm3p/kwiml/int.h
new file mode 100644
index 0000000..4c7c23d
--- /dev/null
+++ b/Utilities/cm3p/kwiml/int.h
@@ -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. */
+#ifndef cm3p_kwiml_int_h
+#define cm3p_kwiml_int_h
+
+/* Use the KWIML library configured for CMake. */
+#include "cmThirdParty.h"
+#ifdef CMAKE_USE_SYSTEM_KWIML
+# include <kwiml/int.h> // IWYU pragma: export
+#else
+# include <KWIML/include/kwiml/int.h> // IWYU pragma: export
+#endif
+
+#endif
diff --git a/Utilities/cm_lzma.h b/Utilities/cm3p/lzma.h
index 0526036..abfacf3 100644
--- a/Utilities/cm_lzma.h
+++ b/Utilities/cm3p/lzma.h
@@ -1,14 +1,14 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_lzma_h
-#define cm_lzma_h
+#ifndef cm3p_lzma_h
+#define cm3p_lzma_h
/* Use the liblzma configured for CMake. */
#include "cmThirdParty.h"
#ifdef CMAKE_USE_SYSTEM_LIBLZMA
-# include <lzma.h>
+# include <lzma.h> // IWYU pragma: export
#else
-# include <cmliblzma/liblzma/api/lzma.h>
+# include <cmliblzma/liblzma/api/lzma.h> // IWYU pragma: export
#endif
#endif
diff --git a/Utilities/cm_rhash.h b/Utilities/cm3p/rhash.h
index 03d9871..9d5e411 100644
--- a/Utilities/cm_rhash.h
+++ b/Utilities/cm3p/rhash.h
@@ -1,14 +1,14 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_rhash_h
-#define cm_rhash_h
+#ifndef cm3p_rhash_h
+#define cm3p_rhash_h
/* Use the LibRHash library configured for CMake. */
#include "cmThirdParty.h"
#ifdef CMAKE_USE_SYSTEM_LIBRHASH
-# include <rhash.h>
+# include <rhash.h> // IWYU pragma: export
#else
-# include <cmlibrhash/librhash/rhash.h>
+# include <cmlibrhash/librhash/rhash.h> // IWYU pragma: export
#endif
#endif
diff --git a/Utilities/cm_uv.h b/Utilities/cm3p/uv.h
index 448f30d..307a09f 100644
--- a/Utilities/cm_uv.h
+++ b/Utilities/cm3p/uv.h
@@ -1,14 +1,14 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_uv_h
-#define cm_uv_h
+#ifndef cm3p_uv_h
+#define cm3p_uv_h
/* Use the libuv library configured for CMake. */
#include "cmThirdParty.h"
#ifdef CMAKE_USE_SYSTEM_LIBUV
-# include <uv.h>
+# include <uv.h> // IWYU pragma: export
#else
-# include <cmlibuv/include/uv.h>
+# include <cmlibuv/include/uv.h> // IWYU pragma: export
#endif
#endif
diff --git a/Utilities/cm_zlib.h b/Utilities/cm3p/zlib.h
index 2314183..fe7baee 100644
--- a/Utilities/cm_zlib.h
+++ b/Utilities/cm3p/zlib.h
@@ -1,14 +1,14 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_zlib_h
-#define cm_zlib_h
+#ifndef cm3p_zlib_h
+#define cm3p_zlib_h
/* Use the zlib library configured for CMake. */
#include "cmThirdParty.h"
#ifdef CMAKE_USE_SYSTEM_ZLIB
-# include <zlib.h>
+# include <zlib.h> // IWYU pragma: export
#else
-# include <cmzlib/zlib.h>
+# include <cmzlib/zlib.h> // IWYU pragma: export
#endif
#endif
diff --git a/Utilities/cm_zstd.h b/Utilities/cm3p/zstd.h
index 4bda996..07cc3e4 100644
--- a/Utilities/cm_zstd.h
+++ b/Utilities/cm3p/zstd.h
@@ -1,14 +1,14 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_zstd_h
-#define cm_zstd_h
+#ifndef cm3p_zstd_h
+#define cm3p_zstd_h
/* Use the libzstd configured for CMake. */
#include "cmThirdParty.h"
#ifdef CMAKE_USE_SYSTEM_ZSTD
-# include <zstd.h>
+# include <zstd.h> // IWYU pragma: export
#else
-# include <cmzstd/lib/zstd.h>
+# include <cmzstd/lib/zstd.h> // IWYU pragma: export
#endif
#endif
diff --git a/Utilities/cmcurl/CMake/OtherTests.cmake b/Utilities/cmcurl/CMake/OtherTests.cmake
index 8b15029..30315dc 100644
--- a/Utilities/cmcurl/CMake/OtherTests.cmake
+++ b/Utilities/cmcurl/CMake/OtherTests.cmake
@@ -26,6 +26,13 @@ endif()
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
+if(1) # CMake hard-codes these
+ set(RECV_TYPE_ARG1 "curl_socket_t")
+ set(RECV_TYPE_ARG2 "char *")
+ set(RECV_TYPE_ARG3 "size_t")
+ set(RECV_TYPE_ARG4 "int")
+ set(RECV_TYPE_RETV "ssize_t")
+else()
check_c_source_compiles("${_source_epilogue}
int main(void) {
recv(0, 0, 0, 0);
@@ -88,8 +95,17 @@ else()
message(FATAL_ERROR "Unable to link function recv")
endif()
set(curl_cv_func_recv_args "${curl_cv_func_recv_args}" CACHE INTERNAL "Arguments for recv")
+endif()
set(HAVE_RECV 1)
+if(1) # CMake hard-codes these
+ set(SEND_QUAL_ARG2 " ")
+ set(SEND_TYPE_ARG1 "curl_socket_t")
+ set(SEND_TYPE_ARG2 "char *")
+ set(SEND_TYPE_ARG3 "size_t")
+ set(SEND_TYPE_ARG4 "int")
+ set(SEND_TYPE_RETV "ssize_t")
+else()
check_c_source_compiles("${_source_epilogue}
int main(void) {
send(0, 0, 0, 0);
@@ -156,6 +172,7 @@ else()
message(FATAL_ERROR "Unable to link function send")
endif()
set(curl_cv_func_send_args "${curl_cv_func_send_args}" CACHE INTERNAL "Arguments for send")
+endif()
set(HAVE_SEND 1)
check_c_source_compiles("${_source_epilogue}
diff --git a/Utilities/cmexpat/lib/siphash.h b/Utilities/cmexpat/lib/siphash.h
index 95f78f8..a335ec0 100644
--- a/Utilities/cmexpat/lib/siphash.h
+++ b/Utilities/cmexpat/lib/siphash.h
@@ -97,7 +97,7 @@
#include <stddef.h> /* size_t */
-#include <cm_kwiml.h>
+#include <cm3p/kwiml/int.h>
#ifndef KWIML_INT_HAVE_UINT64_T
# define uint64_t KWIML_INT_uint64_t
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_bzip2.c b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_bzip2.c
index 2b1a5e2..5333d47 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_bzip2.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_bzip2.c
@@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
#endif
#ifdef HAVE_BZLIB_H
-#include <cm_bzlib.h>
+#include <cm3p/bzlib.h>
#endif
#include "archive.h"
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_gzip.c b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_gzip.c
index 95cfd54..ac0b694 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_gzip.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_gzip.c
@@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
#endif
#ifdef HAVE_ZLIB_H
-#include <cm_zlib.h>
+#include <cm3p/zlib.h>
#endif
#include "archive.h"
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_lzop.c b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_lzop.c
index 4356b82..05f740b 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_lzop.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_lzop.c
@@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$");
#include <lzo/lzo1x.h>
#endif
#ifdef HAVE_ZLIB_H
-#include <cm_zlib.h> /* for crc32 and adler32 */
+#include <cm3p/zlib.h> /* for crc32 and adler32 */
#endif
#include "archive.h"
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_xz.c b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_xz.c
index a188186..3223b38 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_xz.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_xz.c
@@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
#endif
#if HAVE_LZMA_H
-#include <cm_lzma.h>
+#include <cm3p/lzma.h>
#endif
#include "archive.h"
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_zstd.c b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_zstd.c
index 4513706..e1ec60e 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_zstd.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_zstd.c
@@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
#endif
#if HAVE_ZSTD_H
-#include <cm_zstd.h>
+#include <cm3p/zstd.h>
#endif
#include "archive.h"
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c
index c9f3527..456b2f8 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c
@@ -33,13 +33,13 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
#endif
#ifdef HAVE_BZLIB_H
-#include <cm_bzlib.h>
+#include <cm3p/bzlib.h>
#endif
#ifdef HAVE_LZMA_H
-#include <cm_lzma.h>
+#include <cm3p/lzma.h>
#endif
#ifdef HAVE_ZLIB_H
-#include <cm_zlib.h>
+#include <cm3p/zlib.h>
#endif
#include "archive.h"
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_cab.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_cab.c
index c789d13..58644ba 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_cab.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_cab.c
@@ -38,7 +38,7 @@
#include <string.h>
#endif
#ifdef HAVE_ZLIB_H
-#include <cm_zlib.h>
+#include <cm3p/zlib.h>
#endif
#include "archive.h"
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_iso9660.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_iso9660.c
index cf1419a..9121166 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_iso9660.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_iso9660.c
@@ -41,7 +41,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_iso9660.c 20
#endif
#include <time.h>
#ifdef HAVE_ZLIB_H
-#include <cm_zlib.h>
+#include <cm3p/zlib.h>
#endif
#include "archive.h"
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar.c
index 1261191..61f2330 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar.c
@@ -32,7 +32,7 @@
#include <time.h>
#include <limits.h>
#ifdef HAVE_ZLIB_H
-#include <cm_zlib.h> /* crc32 */
+#include <cm3p/zlib.h> /* crc32 */
#endif
#include "archive.h"
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar5.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar5.c
index ec40cce..d3a1c1b 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar5.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar5.c
@@ -31,7 +31,7 @@
#endif
#include <time.h>
#ifdef HAVE_ZLIB_H
-#include <cm_zlib.h> /* crc32 */
+#include <cm3p/zlib.h> /* crc32 */
#endif
#ifdef HAVE_LIMITS_H
#include <limits.h>
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_xar.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_xar.c
index 2bc5c7b..9489e51 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_xar.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_xar.c
@@ -39,13 +39,13 @@ __FBSDID("$FreeBSD$");
#include <expat.h>
#endif
#ifdef HAVE_BZLIB_H
-#include <cm_bzlib.h>
+#include <cm3p/bzlib.h>
#endif
#if HAVE_LZMA_H
-#include <cm_lzma.h>
+#include <cm3p/lzma.h>
#endif
#ifdef HAVE_ZLIB_H
-#include <cm_zlib.h>
+#include <cm3p/zlib.h>
#endif
#include "archive.h"
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c
index 36831f7..4d71f98 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c
@@ -50,7 +50,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_zip.c 201102
#include <stdlib.h>
#endif
#ifdef HAVE_ZLIB_H
-#include <cm_zlib.h>
+#include <cm3p/zlib.h>
#endif
#ifdef HAVE_BZLIB_H
#include <bzlib.h>
diff --git a/Utilities/cmlibarchive/libarchive/archive_util.c b/Utilities/cmlibarchive/libarchive/archive_util.c
index e4cb051..10dca73 100644
--- a/Utilities/cmlibarchive/libarchive/archive_util.c
+++ b/Utilities/cmlibarchive/libarchive/archive_util.c
@@ -46,13 +46,13 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_util.c 201098 2009-12-28 02:58:1
#include <wincrypt.h>
#endif
#ifdef HAVE_ZLIB_H
-#include <cm_zlib.h>
+#include <cm3p/zlib.h>
#endif
#ifdef HAVE_LZMA_H
-#include <cm_lzma.h>
+#include <cm3p/lzma.h>
#endif
#ifdef HAVE_BZLIB_H
-#include <cm_bzlib.h>
+#include <cm3p/bzlib.h>
#endif
#ifdef HAVE_LZ4_H
#include <lz4.h>
diff --git a/Utilities/cmlibarchive/libarchive/archive_version_details.c b/Utilities/cmlibarchive/libarchive/archive_version_details.c
index b9af6d7..5f5a5b7 100644
--- a/Utilities/cmlibarchive/libarchive/archive_version_details.c
+++ b/Utilities/cmlibarchive/libarchive/archive_version_details.c
@@ -34,19 +34,19 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_util.c 201098 2009-12-28 02:58:1
#include <string.h>
#endif
#ifdef HAVE_ZLIB_H
-#include <cm_zlib.h>
+#include <cm3p/zlib.h>
#endif
#ifdef HAVE_LZMA_H
-#include <cm_lzma.h>
+#include <cm3p/lzma.h>
#endif
#ifdef HAVE_BZLIB_H
-#include <cm_bzlib.h>
+#include <cm3p/bzlib.h>
#endif
#ifdef HAVE_LZ4_H
#include <lz4.h>
#endif
#ifdef HAVE_ZSTD_H
-#include <cm_zstd.h>
+#include <cm3p/zstd.h>
#endif
#include "archive.h"
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_bzip2.c b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_bzip2.c
index 535ef17..0637e96 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_bzip2.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_bzip2.c
@@ -39,7 +39,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_compression_bzip2.c 20
#include <string.h>
#endif
#ifdef HAVE_BZLIB_H
-#include <cm_bzlib.h>
+#include <cm3p/bzlib.h>
#endif
#include "archive.h"
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_gzip.c b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_gzip.c
index 8d6838b..3e26605 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_gzip.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_gzip.c
@@ -38,7 +38,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_compression_gzip.c 201
#endif
#include <time.h>
#ifdef HAVE_ZLIB_H
-#include <cm_zlib.h>
+#include <cm3p/zlib.h>
#endif
#include "archive.h"
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_xz.c b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_xz.c
index 2ad4bcb..d567ac9 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_xz.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_xz.c
@@ -39,7 +39,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_compression_xz.c 20110
#endif
#include <time.h>
#ifdef HAVE_LZMA_H
-#include <cm_lzma.h>
+#include <cm3p/lzma.h>
#endif
#include "archive.h"
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_zstd.c b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_zstd.c
index d0d78a0..f67b025 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_zstd.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_zstd.c
@@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#endif
#ifdef HAVE_ZSTD_H
-#include <cm_zstd.h>
+#include <cm3p/zstd.h>
#endif
#include "archive.h"
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_disk_posix.c b/Utilities/cmlibarchive/libarchive/archive_write_disk_posix.c
index 1f7e673..c4be9b0 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_disk_posix.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_disk_posix.c
@@ -131,7 +131,7 @@ __FBSDID("$FreeBSD$");
#endif
#ifdef HAVE_ZLIB_H
-#include <cm_zlib.h>
+#include <cm3p/zlib.h>
#endif
/* TODO: Support Mac OS 'quarantine' feature. This is really just a
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_format_7zip.c b/Utilities/cmlibarchive/libarchive/archive_write_set_format_7zip.c
index ce96f2f..69af814 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_set_format_7zip.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_set_format_7zip.c
@@ -31,13 +31,13 @@ __FBSDID("$FreeBSD$");
#endif
#include <stdlib.h>
#ifdef HAVE_BZLIB_H
-#include <cm_bzlib.h>
+#include <cm3p/bzlib.h>
#endif
#if HAVE_LZMA_H
-#include <cm_lzma.h>
+#include <cm3p/lzma.h>
#endif
#ifdef HAVE_ZLIB_H
-#include <cm_zlib.h>
+#include <cm3p/zlib.h>
#endif
#include "archive.h"
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_format_iso9660.c b/Utilities/cmlibarchive/libarchive/archive_write_set_format_iso9660.c
index 564d4d7..5db414f 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_set_format_iso9660.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_set_format_iso9660.c
@@ -47,7 +47,7 @@
#include <unistd.h>
#endif
#ifdef HAVE_ZLIB_H
-#include <cm_zlib.h>
+#include <cm3p/zlib.h>
#endif
#include "archive.h"
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_format_xar.c b/Utilities/cmlibarchive/libarchive/archive_write_set_format_xar.c
index 358f61f..3b0ffb3 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_set_format_xar.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_set_format_xar.c
@@ -37,13 +37,13 @@ __FBSDID("$FreeBSD$");
#include <libxml/xmlwriter.h>
#endif
#ifdef HAVE_BZLIB_H
-#include <cm_bzlib.h>
+#include <cm3p/bzlib.h>
#endif
#if HAVE_LZMA_H
-#include <cm_lzma.h>
+#include <cm3p/lzma.h>
#endif
#ifdef HAVE_ZLIB_H
-#include <cm_zlib.h>
+#include <cm3p/zlib.h>
#endif
#include "archive.h"
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_format_zip.c b/Utilities/cmlibarchive/libarchive/archive_write_set_format_zip.c
index 1ede5ee..b0cd215 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_set_format_zip.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_set_format_zip.c
@@ -45,7 +45,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_zip.c 201168 20
#include <string.h>
#endif
#ifdef HAVE_ZLIB_H
-#include <cm_zlib.h>
+#include <cm3p/zlib.h>
#endif
#include "archive.h"
diff --git a/Utilities/cmlibrhash/librhash/byte_order.h b/Utilities/cmlibrhash/librhash/byte_order.h
index a58174b..cfb9e25 100644
--- a/Utilities/cmlibrhash/librhash/byte_order.h
+++ b/Utilities/cmlibrhash/librhash/byte_order.h
@@ -39,7 +39,7 @@ extern "C" {
# endif
#endif
-#include <cm_kwiml.h>
+#include <cm3p/kwiml/abi.h>
#if KWIML_ABI_ENDIAN_ID == KWIML_ABI_ENDIAN_ID_LITTLE
# define CPU_LITTLE_ENDIAN
# define IS_BIG_ENDIAN 0
diff --git a/Utilities/cmlibrhash/librhash/ustd.h b/Utilities/cmlibrhash/librhash/ustd.h
index 917fb6b..756ce0b 100644
--- a/Utilities/cmlibrhash/librhash/ustd.h
+++ b/Utilities/cmlibrhash/librhash/ustd.h
@@ -9,7 +9,7 @@
# pragma warning(push,1)
#endif
-#include <cm_kwiml.h>
+#include <cm3p/kwiml/int.h>
#ifndef KWIML_INT_HAVE_INT64_T
# define int64_t KWIML_INT_int64_t
diff --git a/Utilities/cmnghttp2/cmakeconfig.h.in b/Utilities/cmnghttp2/cmakeconfig.h.in
index d6693ee..60698fb 100644
--- a/Utilities/cmnghttp2/cmakeconfig.h.in
+++ b/Utilities/cmnghttp2/cmakeconfig.h.in
@@ -2,7 +2,8 @@
# pragma warning(push,1)
#endif
-#include <cm_kwiml.h>
+#include <cm3p/kwiml/abi.h>
+#include <cm3p/kwiml/int.h>
/* Define to `int' if <sys/types.h> does not define. */
#cmakedefine ssize_t @ssize_t@
diff --git a/Utilities/cmzlib/CMakeLists.txt b/Utilities/cmzlib/CMakeLists.txt
index 888c3ff..0584c55 100644
--- a/Utilities/cmzlib/CMakeLists.txt
+++ b/Utilities/cmzlib/CMakeLists.txt
@@ -38,11 +38,6 @@ CONFIGURE_FILE(${CMZLIB_SOURCE_DIR}/.NoDartCoverage
CONFIGURE_FILE(${CMZLIB_SOURCE_DIR}/zlibDllConfig.h.in
${CMZLIB_BINARY_DIR}/zlibDllConfig.h)
-FOREACH(name zlib zconf cm_zlib_mangle)
- CONFIGURE_FILE(${CMZLIB_SOURCE_DIR}/${name}.h
- ${CMZLIB_BINARY_DIR}/${name}.h COPYONLY)
-ENDFOREACH(name)
-
ADD_LIBRARY(cmzlib ${ZLIB_SRCS})
diff --git a/Utilities/std/cm/bits/string_view.cxx b/Utilities/std/cm/bits/string_view.cxx
index e345fd3..5381fe6 100644
--- a/Utilities/std/cm/bits/string_view.cxx
+++ b/Utilities/std/cm/bits/string_view.cxx
@@ -9,7 +9,7 @@
# include <ostream>
# include <stdexcept>
-# include "cm_kwiml.h"
+# include <cm3p/kwiml/int.h>
namespace cm {
diff --git a/Utilities/std/cm/shared_mutex b/Utilities/std/cm/shared_mutex
index 2ac9447..ec63a7b 100644
--- a/Utilities/std/cm/shared_mutex
+++ b/Utilities/std/cm/shared_mutex
@@ -17,7 +17,7 @@
# include <shared_mutex> // IWYU pragma: export
#endif
#if !defined(CMake_HAVE_CXX_SHARED_MUTEX)
-# include "cm_uv.h"
+# include <cm3p/uv.h>
#endif
namespace cm {
diff --git a/bootstrap b/bootstrap
index 0a65043..6b205cc 100755
--- a/bootstrap
+++ b/bootstrap
@@ -46,7 +46,7 @@ cmake_install_dest_default()
cmake_toupper()
{
- echo "$1" | tr '[:lower:]' '[:upper:]'
+ echo "$1" | tr '[a-z]' '[A-Z]'
}
# Detect system and directory information.
@@ -60,7 +60,7 @@ cmake_version_minor="`cmake_version_component MINOR`"
cmake_version_patch="`cmake_version_component PATCH`"
cmake_version="${cmake_version_major}.${cmake_version_minor}.${cmake_version_patch}"
cmake_version_rc="`cmake_version_component RC`"
-if [ "$cmake_version_rc" != "" ]; then
+if test "$cmake_version_rc" != ""; then
cmake_version="${cmake_version}-rc${cmake_version_rc}"
fi
@@ -209,13 +209,13 @@ esac
# Choose the default install prefix.
if ${cmake_system_mingw}; then
- if [ "x${PROGRAMFILES}" != "x" ]; then
+ if test "x${PROGRAMFILES}" != "x"; then
cmake_default_prefix=`cmake_fix_slashes "${PROGRAMFILES}/CMake"`
- elif [ "x${ProgramFiles}" != "x" ]; then
+ elif test "x${ProgramFiles}" != "x"; then
cmake_default_prefix=`cmake_fix_slashes "${ProgramFiles}/CMake"`
- elif [ "x${SYSTEMDRIVE}" != "x" ]; then
+ elif test "x${SYSTEMDRIVE}" != "x"; then
cmake_default_prefix=`cmake_fix_slashes "${SYSTEMDRIVE}/Program Files/CMake"`
- elif [ "x${SystemDrive}" != "x" ]; then
+ elif test "x${SystemDrive}" != "x"; then
cmake_default_prefix=`cmake_fix_slashes "${SystemDrive}/Program Files/CMake"`
else
cmake_default_prefix="c:/Program Files/CMake"
@@ -247,8 +247,12 @@ CMAKE_PROBLEMATIC_FILES="\
*/CMakeCXXCompiler.cmake \
Source/cmConfigure.h \
Source/CTest/Curl/config.h \
- Utilities/cmexpat/expatConfig.h \
- Utilities/cmexpat/expatDllConfig.h \
+ Utilities/cmThirdParty.h \
+ Utilities/cmcurl/lib/curl_config.h \
+ Utilities/cmlibarchive/config.h \
+ Utilities/cmliblzma/config.h \
+ Utilities/cmnghttp2/config.h \
+ Utilities/cmzlib/zlibDllConfig.h \
"
CMAKE_UNUSED_SOURCES="\
@@ -412,7 +416,6 @@ CMAKE_CXX_SOURCES="\
cmProcessOutput \
cmProjectCommand \
cmPropertyDefinition \
- cmPropertyDefinitionMap \
cmPropertyMap \
cmReturnCommand \
cmRulePlaceholderExpander \
@@ -671,7 +674,7 @@ cmake_error()
echo "Error when bootstrapping CMake:"
echo "$*"
echo "---------------------------------------------"
- if [ -f cmake_bootstrap.log ]; then
+ if test -f cmake_bootstrap.log; then
echo "Log of errors: `pwd`/cmake_bootstrap.log"
#cat cmake_bootstrap.log
echo "---------------------------------------------"
@@ -698,9 +701,9 @@ cmake_replace_string ()
OUTFILE="$2"
SEARCHFOR="$3"
REPLACEWITH="$4"
- if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then
+ if test -f "${INFILE}" || ${cmake_system_openvms}; then
sed "s/\@${SEARCHFOR}\@/${REPLACEWITH}/g" "${INFILE}" > "${OUTFILE}${_tmp}"
- if [ -f "${OUTFILE}${_tmp}" ]; then
+ if test -f "${OUTFILE}${_tmp}"; then
if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
#echo "Files are the same"
rm -f "${OUTFILE}${_tmp}"
@@ -719,7 +722,7 @@ cmake_kwsys_config_replace_string ()
OUTFILE="$2"
shift 2
APPEND="$*"
- if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then
+ if test -f "${INFILE}" || ${cmake_system_openvms}; then
echo "${APPEND}" > "${OUTFILE}${_tmp}"
sed "/./ {s/\@KWSYS_NAMESPACE\@/cmsys/g;
s/@KWSYS_BUILD_SHARED@/${KWSYS_BUILD_SHARED}/g;
@@ -730,7 +733,7 @@ cmake_kwsys_config_replace_string ()
s/@KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H@/${KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H}/g;
s/@KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP@/${KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP}/g;
}" "${INFILE}" >> "${OUTFILE}${_tmp}"
- if [ -f "${OUTFILE}${_tmp}" ]; then
+ if test -f "${OUTFILE}${_tmp}"; then
if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
#echo "Files are the same"
rm -f "${OUTFILE}${_tmp}"
@@ -787,7 +790,7 @@ cmake_try_run ()
COMPILER=$1
FLAGS=$2
TESTFILE=$3
- if [ ! -f "${TESTFILE}" ]; then
+ if test ! -f "${TESTFILE}"; then
echo "Test file ${TESTFILE} missing. Please verify your CMake source tree."
exit 4
fi
@@ -799,18 +802,18 @@ cmake_try_run ()
echo "------------------------------------------"
"${COMPILER}" ${FLAGS} "${TESTFILE}" -o "${TMPFILE}"
RES=$?
- if [ "${RES}" -ne "0" ]; then
+ if test "${RES}" -ne "0"; then
echo "Test failed to compile"
return 1
fi
- if [ ! -f "${TMPFILE}" ] && [ ! -f "${TMPFILE}.exe" ]; then
+ if test ! -f "${TMPFILE}" && test ! -f "${TMPFILE}.exe"; then
echo "Test failed to produce executable"
return 2
fi
./${TMPFILE}
RES=$?
rm -f "${TMPFILE}"
- if [ "${RES}" -ne "0" ]; then
+ if test "${RES}" -ne "0"; then
echo "Test produced non-zero return code"
return 3
fi
@@ -826,18 +829,18 @@ cmake_try_make ()
echo "Try: ${MAKE_PROC}"
"${MAKE_PROC}" ${MAKE_FLAGS}
RES=$?
- if [ "${RES}" -ne "0" ]; then
+ if test "${RES}" -ne "0"; then
echo "${MAKE_PROC} does not work"
return 1
fi
- if [ ! -f "test" ] && [ ! -f "test.exe" ]; then
+ if test ! -f "test" && test ! -f "test.exe"; then
echo "${COMPILER} does not produce output"
return 2
fi
./test
RES=$?
rm -f "test"
- if [ "${RES}" -ne "0" ]; then
+ if test "${RES}" -ne "0"; then
echo "${MAKE_PROC} produces strange executable"
return 3
fi
@@ -894,13 +897,13 @@ while test $# != 0; do
done
# If verbose, display some information about bootstrap
-if [ -n "${cmake_verbose}" ]; then
+if test -n "${cmake_verbose}"; then
echo "---------------------------------------------"
echo "Source directory: ${cmake_source_dir}"
echo "Binary directory: ${cmake_binary_dir}"
echo "Prefix directory: ${cmake_prefix_dir}"
echo "System: ${cmake_system}"
- if [ "x${cmake_parallel_make}" != "x" ]; then
+ if test "x${cmake_parallel_make}" != "x"; then
echo "Doing parallel make: ${cmake_parallel_make}"
fi
echo ""
@@ -912,18 +915,18 @@ echo "`cmake_version_display`"
# Check for in-source build
cmake_in_source_build=
-if [ -f "${cmake_binary_dir}/Source/cmake.cxx" -a \
- -f "${cmake_binary_dir}/Source/cmake.h" ]; then
- if [ -n "${cmake_verbose}" ]; then
+if test -f "${cmake_binary_dir}/Source/cmake.cxx" &&
+ test -f "${cmake_binary_dir}/Source/cmake.h"; then
+ if test -n "${cmake_verbose}"; then
echo "Warning: This is an in-source build"
fi
cmake_in_source_build=TRUE
fi
# If this is not an in-source build, then Bootstrap stuff should not exist.
-if [ -z "${cmake_in_source_build}" ]; then
+if test -z "${cmake_in_source_build}"; then
# Did somebody bootstrap in the source tree?
- if [ -d "${cmake_source_dir}/Bootstrap${_cmk}" ]; then
+ if test -d "${cmake_source_dir}/Bootstrap${_cmk}"; then
cmake_error 10 "Found directory \"${cmake_source_dir}/Bootstrap${_cmk}\".
Looks like somebody did bootstrap CMake in the source tree, but now you are
trying to do bootstrap in the binary tree. Please remove Bootstrap${_cmk}
@@ -931,7 +934,7 @@ directory from the source tree."
fi
# Is there a cache in the source tree?
for cmake_problematic_file in ${CMAKE_PROBLEMATIC_FILES}; do
- if [ -f "${cmake_source_dir}/${cmake_problematic_file}" ]; then
+ if test -f "${cmake_source_dir}/${cmake_problematic_file}"; then
cmake_error 10 "Found \"${cmake_source_dir}/${cmake_problematic_file}\".
Looks like somebody tried to build CMake in the source tree, but now you are
trying to do bootstrap in the binary tree. Please remove \"${cmake_problematic_file}\"
@@ -941,14 +944,14 @@ from the source tree."
fi
# Make bootstrap directory
-[ -d "${cmake_bootstrap_dir}" ] || mkdir "${cmake_bootstrap_dir}"
-if [ ! -d "${cmake_bootstrap_dir}" ]; then
+test -d "${cmake_bootstrap_dir}" || mkdir "${cmake_bootstrap_dir}"
+if test ! -d "${cmake_bootstrap_dir}"; then
cmake_error 3 "Cannot create directory ${cmake_bootstrap_dir} to bootstrap CMake."
fi
cd "${cmake_bootstrap_dir}"
-[ -d "cmsys" ] || mkdir "cmsys"
-if [ ! -d "cmsys" ]; then
+test -d "cmsys" || mkdir "cmsys"
+if test ! -d "cmsys"; then
cmake_error 4 "Cannot create directory ${cmake_bootstrap_dir}/cmsys"
fi
@@ -959,7 +962,7 @@ rm -f "${cmake_bootstrap_dir}/cmVersionConfig.h${_tmp}"
# If building in-source, remove any cmConfigure.h that may
# have been created by a previous run of the bootstrap cmake.
-if [ -n "${cmake_in_source_build}" ]; then
+if test -n "${cmake_in_source_build}"; then
rm -f "${cmake_source_dir}/Source/cmConfigure.h"
fi
@@ -1044,7 +1047,7 @@ cmake_toolchain_detect()
done
}
-if [ -z "${CC}" -a -z "${CXX}" ]; then
+if test -z "${CC}" && test -z "${CXX}"; then
cmake_toolchain_detect
fi
@@ -1058,9 +1061,9 @@ esac
cmake_c_compiler=
# If CC is set, use that for compiler, otherwise use list of known compilers
-if [ -n "${cmake_toolchain}" ]; then
+if test -n "${cmake_toolchain}"; then
eval cmake_c_compilers="\${cmake_toolchain_${cmake_toolchain}_CC}"
-elif [ -n "${CC}" ]; then
+elif test -n "${CC}"; then
cmake_c_compilers="${CC}"
else
cmake_c_compilers="${CMAKE_KNOWN_C_COMPILERS}"
@@ -1111,7 +1114,7 @@ for std in 11 99 90; do
done
rm -f "${TMPFILE}.c"
-if [ -z "${cmake_c_compiler}" ]; then
+if test -z "${cmake_c_compiler}"; then
cmake_error 6 "Cannot find appropriate C compiler on this system.
Please specify one using environment variable CC.
See cmake_bootstrap.log for compilers attempted.
@@ -1126,9 +1129,9 @@ cmake_cxx_compiler=
# On Mac OSX, CC is the same as cc, so make sure not to try CC as c++ compiler.
# If CC is set, use that for compiler, otherwise use list of known compilers
-if [ -n "${cmake_toolchain}" ]; then
+if test -n "${cmake_toolchain}"; then
eval cmake_cxx_compilers="\${cmake_toolchain_${cmake_toolchain}_CXX}"
-elif [ -n "${CXX}" ]; then
+elif test -n "${CXX}"; then
cmake_cxx_compilers="${CXX}"
else
cmake_cxx_compilers="${CMAKE_KNOWN_CXX_COMPILERS}"
@@ -1232,7 +1235,7 @@ for std in 17 14 11; do
done
rm -f "${TMPFILE}.cxx"
-if [ -z "${cmake_cxx_compiler}" ]; then
+if test -z "${cmake_cxx_compiler}"; then
cmake_error 7 "Cannot find a C++ compiler that supports both C++11 and the specified C++ flags.
Please specify one using environment variable CXX.
The C++ flags are \"$cmake_cxx_flags\".
@@ -1259,7 +1262,7 @@ cmake_have_cxx_features=""
for feature in ${cmake_cxx_features}; do
feature_variable="cmake_have_cxx_${feature}"
eval "feature_value=\${${feature_variable}}"
- if [ "${feature_value}" -eq "1" ]; then
+ if test "${feature_value}" -eq "1"; then
cmake_have_cxx_features="${cmake_have_cxx_features} -DCMake_HAVE_CXX_`cmake_toupper ${feature}`=${feature_value}"
fi
done
@@ -1271,7 +1274,7 @@ cmake_make_processor=
cmake_make_flags=
# If MAKE is set, use that for make processor, otherwise use list of known make
-if [ -n "${MAKE}" ]; then
+if test -n "${MAKE}"; then
cmake_make_processors="${MAKE}"
else
cmake_make_processors="${CMAKE_KNOWN_MAKE_PROCESSORS}"
@@ -1290,20 +1293,20 @@ echo '
int main(){ printf("1%c", (char)0x0a); return 0; }
' > "test.c"
cmake_original_make_flags="${cmake_make_flags}"
-if [ "x${cmake_parallel_make}" != "x" ]; then
+if test "x${cmake_parallel_make}" != "x"; then
cmake_make_flags="${cmake_make_flags} -j ${cmake_parallel_make}"
fi
for a in ${cmake_make_processors}; do
- if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then
+ if test -z "${cmake_make_processor}" && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then
cmake_make_processor="${a}"
fi
done
cmake_full_make_flags="${cmake_make_flags}"
-if [ "x${cmake_original_make_flags}" != "x${cmake_make_flags}" ]; then
- if [ -z "${cmake_make_processor}" ]; then
+if test "x${cmake_original_make_flags}" != "x${cmake_make_flags}"; then
+ if test -z "${cmake_make_processor}"; then
cmake_make_flags="${cmake_original_make_flags}"
for a in ${cmake_make_processors}; do
- if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then
+ if test -z "${cmake_make_processor}" && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then
cmake_make_processor="${a}"
fi
done
@@ -1311,13 +1314,13 @@ if [ "x${cmake_original_make_flags}" != "x${cmake_make_flags}" ]; then
fi
cd "${cmake_bootstrap_dir}"
-if [ -z "${cmake_make_processor}" ]; then
+if test -z "${cmake_make_processor}"; then
cmake_error 8 "Cannot find appropriate Makefile processor on this system.
Please specify one using environment variable MAKE."
fi
rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
echo "Makefile processor on this system is: ${cmake_make_processor}"
-if [ "x${cmake_full_make_flags}" != "x${cmake_make_flags}" ]; then
+if test "x${cmake_full_make_flags}" != "x${cmake_make_flags}"; then
echo "---------------------------------------------"
echo "Makefile processor ${cmake_make_processor} does not support parallel build"
echo "---------------------------------------------"
@@ -1382,7 +1385,7 @@ else
echo "${cmake_cxx_compiler} does not have <ext/stdio_filebuf.h>"
fi
-if [ -n "${cmake_ccache_enabled}" ]; then
+if test -n "${cmake_ccache_enabled}"; then
echo "Building CMake with ccache"
cmake_c_compiler="ccache ${cmake_c_compiler}"
cmake_cxx_compiler="ccache ${cmake_cxx_compiler}"
@@ -1532,15 +1535,15 @@ else
fi
uv_c_flags="${uv_c_flags} `cmake_escape "-I${cmake_source_dir}/Utilities/cmlibuv/src"`"
-if [ "x${cmake_ansi_cxx_flags}" != "x" ]; then
+if test "x${cmake_ansi_cxx_flags}" != "x"; then
cmake_cxx_flags="${cmake_ansi_cxx_flags} ${cmake_cxx_flags}"
fi
-if [ "x${cmake_c_flags}" != "x" ]; then
+if test "x${cmake_c_flags}" != "x"; then
cmake_c_flags="${cmake_c_flags} "
fi
-if [ "x${cmake_cxx_flags}" != "x" ]; then
+if test "x${cmake_cxx_flags}" != "x"; then
cmake_cxx_flags="${cmake_cxx_flags} "
fi
@@ -1637,42 +1640,42 @@ set (CMAKE_XDGDATA_DIR "'"${cmake_xdgdata_dir}"'" CACHE PATH "Install location f
' > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
# Add configuration settings given as command-line options.
-if [ "x${cmake_bootstrap_qt_gui}" != "x" ]; then
+if test "x${cmake_bootstrap_qt_gui}" != "x"; then
echo '
set (BUILD_QtDialog '"${cmake_bootstrap_qt_gui}"' CACHE BOOL "Build Qt dialog for CMake" FORCE)
' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
fi
-if [ "x${cmake_bootstrap_qt_qmake}" != "x" ]; then
+if test "x${cmake_bootstrap_qt_qmake}" != "x"; then
echo '
set (QT_QMAKE_EXECUTABLE "'"${cmake_bootstrap_qt_qmake}"'" CACHE FILEPATH "Location of Qt qmake" FORCE)
' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
fi
-if [ "x${cmake_sphinx_info}" != "x" ]; then
+if test "x${cmake_sphinx_info}" != "x"; then
echo '
set (SPHINX_INFO "'"${cmake_sphinx_info}"'" CACHE BOOL "Build Info manual with Sphinx" FORCE)
' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
fi
-if [ "x${cmake_sphinx_man}" != "x" ]; then
+if test "x${cmake_sphinx_man}" != "x"; then
echo '
set (SPHINX_MAN "'"${cmake_sphinx_man}"'" CACHE BOOL "Build man pages with Sphinx" FORCE)
' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
fi
-if [ "x${cmake_sphinx_html}" != "x" ]; then
+if test "x${cmake_sphinx_html}" != "x"; then
echo '
set (SPHINX_HTML "'"${cmake_sphinx_html}"'" CACHE BOOL "Build html help with Sphinx" FORCE)
' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
fi
-if [ "x${cmake_sphinx_qthelp}" != "x" ]; then
+if test "x${cmake_sphinx_qthelp}" != "x"; then
echo '
set (SPHINX_QTHELP "'"${cmake_sphinx_qthelp}"'" CACHE BOOL "Build qch help with Sphinx" FORCE)
' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
fi
-if [ "x${cmake_sphinx_build}" != "x" ]; then
+if test "x${cmake_sphinx_build}" != "x"; then
echo '
set (SPHINX_EXECUTABLE "'"${cmake_sphinx_build}"'" CACHE FILEPATH "Location of Qt sphinx-build" FORCE)
' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
fi
-if [ "x${cmake_sphinx_flags}" != "x" ]; then
+if test "x${cmake_sphinx_flags}" != "x"; then
echo '
set (SPHINX_FLAGS [==['"${cmake_sphinx_flags}"']==] CACHE STRING "Flags to pass to sphinx-build" FORCE)
' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
@@ -1682,7 +1685,7 @@ fi
# specification of cmake_init_file.
(
cd "${cmake_binary_dir}"
-if [ -f "${cmake_init_file}" ]; then
+if test -f "${cmake_init_file}"; then
cat "${cmake_init_file}" >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
fi
)
@@ -1690,13 +1693,13 @@ fi
echo "---------------------------------------------"
# Run make to build bootstrap cmake
-if [ "x${cmake_parallel_make}" != "x" ]; then
+if test "x${cmake_parallel_make}" != "x"; then
${cmake_make_processor} ${cmake_make_flags}
else
${cmake_make_processor}
fi
RES=$?
-if [ "${RES}" -ne "0" ]; then
+if test "${RES}" -ne "0"; then
cmake_error 9 "Problem while running ${cmake_make_processor}"
fi
cd "${cmake_binary_dir}"
@@ -1715,12 +1718,12 @@ export LDFLAGS
# Run bootstrap CMake to configure real CMake
cmake_options="-DCMAKE_BOOTSTRAP=1"
-if [ -n "${cmake_verbose}" ]; then
+if test -n "${cmake_verbose}"; then
cmake_options="${cmake_options} -DCMAKE_VERBOSE_MAKEFILE=1"
fi
"${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake" "-G${cmake_bootstrap_generator}" ${cmake_options} ${cmake_bootstrap_system_libs} "$@"
RES=$?
-if [ "${RES}" -ne "0" ]; then
+if test "${RES}" -ne "0"; then
cmake_error 11 "Problem while running initial CMake"
fi