diff options
51 files changed, 353 insertions, 188 deletions
diff --git a/Help/guide/importing-exporting/MathFunctions/CMakeLists.txt b/Help/guide/importing-exporting/MathFunctions/CMakeLists.txt index 9a9e40e..d277b54 100644 --- a/Help/guide/importing-exporting/MathFunctions/CMakeLists.txt +++ b/Help/guide/importing-exporting/MathFunctions/CMakeLists.txt @@ -1,6 +1,9 @@ cmake_minimum_required(VERSION 3.15) project(MathFunctions) +# make cache variables for install destinations +include(GNUInstallDirs) + # specify the C++ standard set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED True) @@ -12,26 +15,26 @@ add_library(MathFunctions STATIC MathFunctions.cxx) target_include_directories(MathFunctions PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>" - "$<INSTALL_INTERFACE:include>" + "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>" ) # install the target and create export-set install(TARGETS MathFunctions EXPORT MathFunctionsTargets - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin - INCLUDES DESTINATION include + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) # install header file -install(FILES MathFunctions.h DESTINATION include) +install(FILES MathFunctions.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) # generate and install export file install(EXPORT MathFunctionsTargets FILE MathFunctionsTargets.cmake NAMESPACE MathFunctions:: - DESTINATION lib/cmake/MathFunctions + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/MathFunctions ) # include CMakePackageConfigHelpers macro @@ -58,14 +61,14 @@ write_basic_package_version_file( # create config file configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfig.cmake" - INSTALL_DESTINATION lib/cmake/MathFunctions + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/MathFunctions ) # install config files install(FILES "${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfigVersion.cmake" - DESTINATION lib/cmake/MathFunctions + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/MathFunctions ) # generate the export targets for the build tree diff --git a/Help/guide/importing-exporting/MathFunctionsComponents/Addition/CMakeLists.txt b/Help/guide/importing-exporting/MathFunctionsComponents/Addition/CMakeLists.txt index 17ad952..9de935e 100644 --- a/Help/guide/importing-exporting/MathFunctionsComponents/Addition/CMakeLists.txt +++ b/Help/guide/importing-exporting/MathFunctionsComponents/Addition/CMakeLists.txt @@ -7,24 +7,24 @@ add_library(MathFunctions::Addition ALIAS Addition) target_include_directories(Addition PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>" - $<INSTALL_INTERFACE:include> + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> ) # install the target and create export-set install(TARGETS Addition EXPORT AdditionTargets - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin - INCLUDES DESTINATION include + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) # install header file -install(FILES Addition.h DESTINATION include) +install(FILES Addition.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) # generate and install export file install(EXPORT AdditionTargets FILE MathFunctionsAdditionTargets.cmake NAMESPACE MathFunctions:: - DESTINATION lib/cmake/MathFunctions + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/MathFunctions ) diff --git a/Help/guide/importing-exporting/MathFunctionsComponents/CMakeLists.txt b/Help/guide/importing-exporting/MathFunctionsComponents/CMakeLists.txt index fd95e28..90ee89f 100644 --- a/Help/guide/importing-exporting/MathFunctionsComponents/CMakeLists.txt +++ b/Help/guide/importing-exporting/MathFunctionsComponents/CMakeLists.txt @@ -1,6 +1,9 @@ cmake_minimum_required(VERSION 3.15) project(MathFunctionsComponents) +# make cache variables for install destinations +include(GNUInstallDirs) + # specify the C++ standard set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED True) @@ -24,7 +27,7 @@ write_basic_package_version_file( # create config file configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfig.cmake" - INSTALL_DESTINATION lib/cmake/MathFunctions + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/MathFunctions NO_CHECK_REQUIRED_COMPONENTS_MACRO ) @@ -32,5 +35,5 @@ configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in install(FILES "${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfigVersion.cmake" - DESTINATION lib/cmake/MathFunctions + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/MathFunctions ) diff --git a/Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot/CMakeLists.txt b/Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot/CMakeLists.txt index be5ae65..517c5e2 100644 --- a/Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot/CMakeLists.txt +++ b/Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot/CMakeLists.txt @@ -7,24 +7,24 @@ add_library(MathFunctions::SquareRoot ALIAS SquareRoot) target_include_directories(SquareRoot PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>" - "$<INSTALL_INTERFACE:include>" + "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>" ) # install the target and create export-set install(TARGETS SquareRoot EXPORT SquareRootTargets - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin - INCLUDES DESTINATION include + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) # install header file -install(FILES SquareRoot.h DESTINATION include) +install(FILES SquareRoot.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) # generate and install export file install(EXPORT SquareRootTargets FILE MathFunctionsSquareRootTargets.cmake NAMESPACE MathFunctions:: - DESTINATION lib/cmake/MathFunctions + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/MathFunctions ) diff --git a/Help/guide/importing-exporting/index.rst b/Help/guide/importing-exporting/index.rst index 2e6e06d..3e60250 100644 --- a/Help/guide/importing-exporting/index.rst +++ b/Help/guide/importing-exporting/index.rst @@ -202,6 +202,10 @@ project. Start by specifying the :command:`cmake_minimum_required` version and :language: cmake :end-before: # create library +The :module:`GNUInstallDirs` module is included in order to provide the +project with the flexibility to install into different platform layouts by +making the directories available as cache variables. + Create a library called ``MathFunctions`` with the :command:`add_library` command: diff --git a/Help/manual/presets/schema.json b/Help/manual/presets/schema.json index dbcead5..c3c3ca1 100644 --- a/Help/manual/presets/schema.json +++ b/Help/manual/presets/schema.json @@ -19,7 +19,7 @@ "properties": { "version": { "const": 2, - "description": "A requVired integer representing the version of the JSON schema." + "description": "A required integer representing the version of the JSON schema." }, "cmakeMinimumRequired": { "$ref": "#/definitions/cmakeMinimumRequired"}, "vendor": { "$ref": "#/definitions/vendor" }, @@ -462,7 +462,7 @@ }, "inheritConfigureEnvironment": { "type": "boolean", - "description": "An optional Boolean that defaults to true. If true, the environment variables from the associated configure preset are inherited after all inherited build preset environments, but before environment variables explicitly specified in this build preset." + "description": "An optional boolean that defaults to true. If true, the environment variables from the associated configure preset are inherited after all inherited build preset environments, but before environment variables explicitly specified in this build preset." }, "environment": { "type": "object", @@ -510,11 +510,11 @@ }, "cleanFirst": { "type": "boolean", - "description": "An optional bool. If true, equivalent to passing --clean-first on the command line." + "description": "An optional boolean. If true, equivalent to passing --clean-first on the command line." }, "verbose": { "type": "boolean", - "description": "An optional bool. If true, equivalent to passing --verbose on the command line." + "description": "An optional boolean. If true, equivalent to passing --verbose on the command line." }, "nativeToolOptions": { "type": "array", @@ -657,7 +657,7 @@ }, "inheritConfigureEnvironment": { "type": "boolean", - "description": "An optional Boolean that defaults to true. If true, the environment variables from the associated configure preset are inherited after all inherited test preset environments, but before environment variables explicitly specified in this test preset." + "description": "An optional boolean that defaults to true. If true, the environment variables from the associated configure preset are inherited after all inherited test preset environments, but before environment variables explicitly specified in this test preset." }, "environment": { "type": "object", @@ -697,7 +697,7 @@ "properties": { "shortProgress": { "type": "boolean", - "description": "An optional bool. If true, equivalent to passing --progress on the command line." + "description": "An optional boolean. If true, equivalent to passing --progress on the command line." }, "verbosity": { "type": "string", @@ -708,15 +708,15 @@ }, "debug": { "type": "boolean", - "description": "An optional bool. If true, equivalent to passing --debug on the command line." + "description": "An optional boolean. If true, equivalent to passing --debug on the command line." }, "outputOnFailure": { "type": "boolean", - "description": "An optional bool. If true, equivalent to passing --output-on-failure on the command line." + "description": "An optional boolean. If true, equivalent to passing --output-on-failure on the command line." }, "quiet": { "type": "boolean", - "description": "An optional bool. If true, equivalent to passing --quiet on the command line." + "description": "An optional boolean. If true, equivalent to passing --quiet on the command line." }, "outputLogFile": { "type": "string", @@ -724,11 +724,11 @@ }, "labelSummary": { "type": "boolean", - "description": "An optional bool. If false, equivalent to passing --no-label-summary on the command line." + "description": "An optional boolean. If false, equivalent to passing --no-label-summary on the command line." }, "subprojectSummary": { "type": "boolean", - "description": "An optional bool. If false, equivalent to passing --no-subproject-summary on the command line." + "description": "An optional boolean. If false, equivalent to passing --no-subproject-summary on the command line." }, "maxPassedTestOutputSize": { "type": "integer", @@ -798,7 +798,7 @@ }, "useUnion": { "type": "boolean", - "description": "An optional bool. Equivalent to passing --union on the command line." + "description": "An optional boolean. Equivalent to passing --union on the command line." } }, "additionalProperties": false @@ -845,11 +845,11 @@ "properties": { "stopOnFailure": { "type": "boolean", - "description": "An optional bool. If true, equivalent to passing --stop-on-failure on the command line." + "description": "An optional boolean. If true, equivalent to passing --stop-on-failure on the command line." }, "enableFailover": { "type": "boolean", - "description": "An optional bool. If true, equivalent to passing -F on the command line." + "description": "An optional boolean. If true, equivalent to passing -F on the command line." }, "jobs": { "type": "integer", @@ -893,11 +893,11 @@ }, "interactiveDebugging": { "type": "boolean", - "description": "An optional bool. If true, equivalent to passing --interactive-debug-mode 1 on the command line. If false, equivalent to passing --interactive-debug-mode 0 on the command line." + "description": "An optional boolean. If true, equivalent to passing --interactive-debug-mode 1 on the command line. If false, equivalent to passing --interactive-debug-mode 0 on the command line." }, "scheduleRandom": { "type": "boolean", - "description": "An optional bool. If true, equivalent to passing --schedule-random on the command line." + "description": "An optional boolean. If true, equivalent to passing --schedule-random on the command line." }, "timeout": { "type": "integer", diff --git a/Help/policy/CMP0118.rst b/Help/policy/CMP0118.rst index b43a766..aa7e0f7 100644 --- a/Help/policy/CMP0118.rst +++ b/Help/policy/CMP0118.rst @@ -10,10 +10,16 @@ property of the source. Consequently, the associated ``GENERATED`` property is now visible from any directory scope, not only from the scope for which it was set. +Additionally, the ``GENERATED`` property may now be set only to boolean +values, and may not be turned off once turned on. + The ``OLD`` behavior of this policy is to only allow ``GENERATED`` to be visible from the directory scope for which it was set. The ``NEW`` behavior on the other hand allows it to be visible from any scope. -This policy was introduced in CMake version 3.20. CMake version |release| -warns when the policy is not set and uses ``OLD`` behavior. Use the +This policy was introduced in CMake version 3.20. Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. +Unlike many policies, CMake version |release| does *not* warn +when this policy is not set and simply uses ``OLD`` behavior with regard +to visibility of the ``GENERATED`` property. However, CMake does warn +about setting the ``GENERATED`` property to a non-boolean value. diff --git a/Help/release/dev/FindDevIL-imported-targets.rst b/Help/release/dev/FindDevIL-imported-targets.rst new file mode 100644 index 0000000..aa0929e --- /dev/null +++ b/Help/release/dev/FindDevIL-imported-targets.rst @@ -0,0 +1,4 @@ +FindDevIL +--------- + +* The :module:`FindDevIL` module now provides imported targets. diff --git a/Help/release/dev/cxx-module-extensions.rst b/Help/release/dev/cxx-module-extensions.rst new file mode 100644 index 0000000..b9d0a8a --- /dev/null +++ b/Help/release/dev/cxx-module-extensions.rst @@ -0,0 +1,4 @@ +cxx-module-extensions +--------------------- + +* Source file extensions ``.ixx`` and ``.cppm`` are now treated as C++. diff --git a/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR.rst b/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR.rst index 74db6b1..a19e7e1 100644 --- a/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR.rst +++ b/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR.rst @@ -9,10 +9,9 @@ The :ref:`Visual Studio Generators` for VS 2010 and above support using a standalone (non-installed) NVIDIA CUDA toolkit. The path may be specified by a field in :variable:`CMAKE_GENERATOR_TOOLSET` of the form ``cuda=C:\path\to\cuda``. The given directory must at least -contain a folder ``.\nvcc`` and must provide Visual Studio integration -files in path ``.\CUDAVisualStudioIntegration\extras\ -visual_studio_integration\MSBuildExtensions\``. One can create a standalone -CUDA toolkit directory by either opening a installer with 7zip or -copying the files that are extracted by the running installer. -The value may be empty if no path to a standalone CUDA Toolkit was -specified. +contain the nvcc compiler in path ``.\bin`` and must provide Visual Studio +integration files in path ``.\extras\visual_studio_integration\ +MSBuildExtensions\``. One can create a standalone CUDA toolkit directory by +either opening a installer with 7zip or copying the files that are extracted +by the running installer. The value may be empty if no path to a standalone +CUDA Toolkit was specified. diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index 45acfe7..d0ce77a 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -44,7 +44,7 @@ if(CMAKE_COMPILER_IS_MINGW) set(MINGW 1) endif() set(CMAKE_CXX_COMPILER_ID_RUN 1) -set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP) +set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm) set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) foreach (lang C OBJC OBJCXX) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 1595cfd..f406e5a 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -452,9 +452,19 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} set(id_ItemDefinitionGroup_entry "<CudaCompile>${cuda_target}<AdditionalOptions>%(AdditionalOptions)-v</AdditionalOptions><CodeGeneration>${cuda_codegen}</CodeGeneration></CudaCompile>") set(id_PostBuildEvent_Command [[echo CMAKE_CUDA_COMPILER=$(CudaToolkitBinDir)\nvcc.exe]]) if(CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR) - set(id_CudaToolkitCustomDir "<CudaToolkitCustomDir>${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}nvcc</CudaToolkitCustomDir>") - string(CONCAT id_Import_props "<Import Project=\"${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}\\CUDAVisualStudioIntegration\\extras\\visual_studio_integration\\MSBuildExtensions\\${cuda_tools}.props\" />") - string(CONCAT id_Import_targets "<Import Project=\"${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}\\CUDAVisualStudioIntegration\\extras\\visual_studio_integration\\MSBuildExtensions\\${cuda_tools}.targets\" />") + # check for legacy cuda custom toolkit folder structure + if(EXISTS ${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}nvcc) + set(id_CudaToolkitCustomDir "<CudaToolkitCustomDir>${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}nvcc</CudaToolkitCustomDir>") + else() + set(id_CudaToolkitCustomDir "<CudaToolkitCustomDir>${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}</CudaToolkitCustomDir>") + endif() + if(EXISTS ${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}CUDAVisualStudioIntegration) + string(CONCAT id_Import_props "<Import Project=\"${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}CUDAVisualStudioIntegration\\extras\\visual_studio_integration\\MSBuildExtensions\\${cuda_tools}.props\" />") + string(CONCAT id_Import_targets "<Import Project=\"${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}CUDAVisualStudioIntegration\\extras\\visual_studio_integration\\MSBuildExtensions\\${cuda_tools}.targets\" />") + else() + string(CONCAT id_Import_props "<Import Project=\"${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}\\extras\\visual_studio_integration\\MSBuildExtensions\\${cuda_tools}.props\" />") + string(CONCAT id_Import_targets "<Import Project=\"${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}\\extras\\visual_studio_integration\\MSBuildExtensions\\${cuda_tools}.targets\" />") + endif() else() string(CONCAT id_Import_props [[<Import Project="$(VCTargetsPath)\BuildCustomizations\]] "${cuda_tools}" [[.props" />]]) string(CONCAT id_Import_targets [[<Import Project="$(VCTargetsPath)\BuildCustomizations\]] "${cuda_tools}" [[.targets" />]]) diff --git a/Modules/FindDevIL.cmake b/Modules/FindDevIL.cmake index 9984943..c8e5e31 100644 --- a/Modules/FindDevIL.cmake +++ b/Modules/FindDevIL.cmake @@ -10,26 +10,57 @@ FindDevIL This module locates the developer's image library. http://openil.sourceforge.net/ +IMPORTED Targets +^^^^^^^^^^^^^^^^ + +.. versionadded:: 3.21 + +This module defines the :prop_tgt:`IMPORTED` targets: + +``DevIL::IL`` + Defined if the system has DevIL. + +``DevIL::ILU`` + Defined if the system has DevIL Utilities. + +``DevIL::ILUT`` + Defined if the system has DevIL Utility Toolkit. + +Result Variables +^^^^^^^^^^^^^^^^ + This module sets: -:: - - IL_LIBRARIES - the name of the IL library. These include the full path to - the core DevIL library. This one has to be linked into the - application. - ILU_LIBRARIES - the name of the ILU library. Again, the full path. This - library is for filters and effects, not actual loading. It - doesn't have to be linked if the functionality it provides - is not used. - ILUT_LIBRARIES - the name of the ILUT library. Full path. This part of the - library interfaces with OpenGL. It is not strictly needed - in applications. - IL_INCLUDE_DIR - where to find the il.h, ilu.h and ilut.h files. - DevIL_FOUND - this is set to TRUE if all the above variables were set. - This will be set to false if ILU or ILUT are not found, - even if they are not needed. In most systems, if one - library is found all the others are as well. That's the - way the DevIL developers release it. +``IL_LIBRARIES`` + The name of the IL library. These include the full path to + the core DevIL library. This one has to be linked into the + application. + +``ILU_LIBRARIES`` + The name of the ILU library. Again, the full path. This + library is for filters and effects, not actual loading. It + doesn't have to be linked if the functionality it provides + is not used. + +``ILUT_LIBRARIES`` + The name of the ILUT library. Full path. This part of the + library interfaces with OpenGL. It is not strictly needed + in applications. + +``IL_INCLUDE_DIR`` + where to find the il.h, ilu.h and ilut.h files. + +``DevIL_FOUND`` + This is set to TRUE if all the above variables were set. + This will be set to false if ILU or ILUT are not found, + even if they are not needed. In most systems, if one + library is found all the others are as well. That's the + way the DevIL developers release it. + +``DevIL_ILUT_FOUND`` + .. versionadded:: 3.21 + + This is set to TRUE if the ILUT library is found. #]=======================================================================] # TODO: Add version support. @@ -73,3 +104,36 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(DevIL DEFAULT_MSG IL_INCLUDE_DIR) # provide legacy variable for compatibility set(IL_FOUND ${DevIL_FOUND}) + +# create imported targets ONLY if we found DevIL. +if(DevIL_FOUND) + # Report the ILUT found if ILUT_LIBRARIES contains valid path. + if (ILUT_LIBRARIES) + set(DevIL_ILUT_FOUND TRUE) + else() + set(DevIL_ILUT_FOUND FALSE) + endif() + + if(NOT TARGET DevIL::IL) + add_library(DevIL::IL UNKNOWN IMPORTED) + set_target_properties(DevIL::IL PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${IL_INCLUDE_DIR}" + IMPORTED_LOCATION "${IL_LIBRARIES}") + endif() + + # DevIL Utilities target + if(NOT TARGET DevIL::ILU) + add_library(DevIL::ILU UNKNOWN IMPORTED) + set_target_properties(DevIL::ILU PROPERTIES + IMPORTED_LOCATION "${ILU_LIBRARIES}") + target_link_libraries(DevIL::ILU INTERFACE DevIL::IL) + endif() + + # ILUT (if found) + if(NOT TARGET DevIL::ILUT AND DevIL_ILUT_FOUND) + add_library(DevIL::ILUT UNKNOWN IMPORTED) + set_target_properties(DevIL::ILUT PROPERTIES + IMPORTED_LOCATION "${ILUT_LIBRARIES}") + target_link_libraries(DevIL::ILUT INTERFACE DevIL::ILU) + endif() +endif() diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 88c1631..d106195 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 20) -set(CMake_VERSION_PATCH 20210319) +set(CMake_VERSION_PATCH 20210323) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 74d8135..d33c763 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -263,8 +263,8 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( bcDir = this->VCTargetsPath + "/BuildCustomizations"; } else { bcDir = this->GetPlatformToolsetCudaCustomDirString() + - "CUDAVisualStudioIntegration\\extras\\" - "visual_studio_integration\\MSBuildExtensions"; + this->GetPlatformToolsetCudaVSIntegrationSubdirString() + + "extras\\visual_studio_integration\\MSBuildExtensions"; cmSystemTools::ConvertToUnixSlashes(bcDir); } cmsys::Glob gl; @@ -470,6 +470,17 @@ bool cmGlobalVisualStudio10Generator::ProcessGeneratorToolsetField( if (this->GeneratorToolsetCudaCustomDir.back() != '\\') { this->GeneratorToolsetCudaCustomDir.push_back('\\'); } + /* check for legacy toolkit folder structure */ + if (cmsys::SystemTools::FileIsDirectory( + cmStrCat(this->GeneratorToolsetCudaCustomDir, "nvcc"))) { + this->GeneratorToolsetCudaNvccSubdir = "nvcc\\"; + } + if (cmsys::SystemTools::FileIsDirectory( + cmStrCat(this->GeneratorToolsetCudaCustomDir, + "CUDAVisualStudioIntegration"))) { + this->GeneratorToolsetCudaVSIntegrationSubdir = + "CUDAVisualStudioIntegration\\"; + } } else { this->GeneratorToolsetCuda = value; } @@ -787,6 +798,18 @@ cmGlobalVisualStudio10Generator::GetPlatformToolsetCudaCustomDirString() const return this->GeneratorToolsetCudaCustomDir; } +std::string const& +cmGlobalVisualStudio10Generator::GetPlatformToolsetCudaNvccSubdirString() const +{ + return this->GeneratorToolsetCudaNvccSubdir; +} + +std::string const& cmGlobalVisualStudio10Generator:: + GetPlatformToolsetCudaVSIntegrationSubdirString() const +{ + return this->GeneratorToolsetCudaVSIntegrationSubdir; +} + cmGlobalVisualStudio10Generator::AuxToolset cmGlobalVisualStudio10Generator::FindAuxToolset(std::string&, std::string&) const diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 5e42c17..e221d4c 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -78,6 +78,13 @@ public: const char* GetPlatformToolsetCudaCustomDir() const; std::string const& GetPlatformToolsetCudaCustomDirString() const; + /** The nvcc subdirectory of a custom cuda install directory */ + std::string const& GetPlatformToolsetCudaNvccSubdirString() const; + + /** The visual studio integration subdirectory of a custom cuda install + * directory */ + std::string const& GetPlatformToolsetCudaVSIntegrationSubdirString() const; + /** Return whether we need to use No/Debug instead of false/true for GenerateDebugInformation. */ bool GetPlatformToolsetNeedsDebugEnum() const @@ -188,6 +195,8 @@ protected: std::string GeneratorToolsetCustomVCTargetsDir; std::string GeneratorToolsetCuda; std::string GeneratorToolsetCudaCustomDir; + std::string GeneratorToolsetCudaNvccSubdir; + std::string GeneratorToolsetCudaVSIntegrationSubdir; std::string DefaultPlatformToolset; std::string DefaultPlatformToolsetHostArchitecture; std::string DefaultAndroidToolset; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index e156625..40a67a3 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1222,7 +1222,7 @@ void cmMakefile::AddCustomCommandOldStyle( // Each output must get its own copy of this rule. cmsys::RegularExpression sourceFiles( - "\\.(C|M|c|c\\+\\+|cc|cpp|cxx|mpp|cu|m|mm|" + "\\.(C|M|c|c\\+\\+|cc|cpp|cxx|mpp|ixx|cppm|cu|m|mm|" "rc|def|r|odl|idl|hpj|bat|h|h\\+\\+|" "hm|hpp|hxx|in|txx|inl)$"); diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 72bc972..3f3c8d5 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -141,14 +141,21 @@ bool cmSourceFile::FindFullPath(std::string* error, std::vector<std::string> exts = makefile->GetCMakeInstance()->GetAllExtensions(); auto cmp0115 = makefile->GetPolicyStatus(cmPolicies::CMP0115); + auto cmp0118 = makefile->GetPolicyStatus(cmPolicies::CMP0118); + bool const cmp0118new = + cmp0118 != cmPolicies::OLD && cmp0118 != cmPolicies::WARN; // Tries to find the file in a given directory - auto findInDir = [this, &exts, &lPath, cmp0115, cmp0115Warning, + auto findInDir = [this, &exts, &lPath, cmp0115, cmp0115Warning, cmp0118new, makefile](std::string const& dir) -> bool { // Compute full path std::string const fullPath = cmSystemTools::CollapseFullPath(lPath, dir); // Try full path - if (cmSystemTools::FileExists(fullPath)) { + if (cmp0118new && + makefile->GetGlobalGenerator()->IsGeneratedFile(fullPath)) { + this->IsGenerated = true; + } + if (this->IsGenerated || cmSystemTools::FileExists(fullPath)) { this->FullPath = fullPath; return true; } @@ -160,7 +167,11 @@ bool cmSourceFile::FindFullPath(std::string* error, for (std::string const& ext : exts) { if (!ext.empty()) { std::string extPath = cmStrCat(fullPath, '.', ext); - if (cmSystemTools::FileExists(extPath)) { + if (cmp0118new && + makefile->GetGlobalGenerator()->IsGeneratedFile(extPath)) { + this->IsGenerated = true; + } + if (this->IsGenerated || cmSystemTools::FileExists(extPath)) { this->FullPath = extPath; if (cmp0115 == cmPolicies::WARN) { std::string warning = diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index 76a5ded..32ed687 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -175,7 +175,7 @@ private: #define CM_HEADER_REGEX "\\.(h|hh|h\\+\\+|hm|hpp|hxx|in|txx|inl)$" #define CM_SOURCE_REGEX \ - "\\.(C|F|M|c|c\\+\\+|cc|cpp|mpp|cxx|cu|f|f90|for|fpp|ftn|m|mm|" \ + "\\.(C|F|M|c|c\\+\\+|cc|cpp|mpp|cxx|ixx|cppm|cu|f|f90|for|fpp|ftn|m|mm|" \ "rc|def|r|odl|idl|hpj|bat)$" #define CM_PCH_REGEX "cmake_pch(_[^.]+)?\\.(h|hxx)$" diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 965ac3e..0255d60 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -545,7 +545,7 @@ void cmVisualStudio10TargetGenerator::Generate() e1.Element( "CudaToolkitCustomDir", this->GlobalGenerator->GetPlatformToolsetCudaCustomDirString() + - "nvcc"); + this->GlobalGenerator->GetPlatformToolsetCudaNvccSubdirString()); } } @@ -654,8 +654,9 @@ void cmVisualStudio10TargetGenerator::Generate() std::string cudaPath = customDir.empty() ? "$(VCTargetsPath)\\BuildCustomizations\\" : customDir + - "CUDAVisualStudioIntegration\\extras\\" - "visual_studio_integration\\MSBuildExtensions\\"; + this->GlobalGenerator + ->GetPlatformToolsetCudaVSIntegrationSubdirString() + + "extras\\visual_studio_integration\\MSBuildExtensions\\"; Elem(e1, "Import") .Attribute("Project", std::move(cudaPath) + "CUDA " + @@ -747,8 +748,9 @@ void cmVisualStudio10TargetGenerator::Generate() std::string cudaPath = customDir.empty() ? "$(VCTargetsPath)\\BuildCustomizations\\" : customDir + - "CUDAVisualStudioIntegration\\extras\\" - "visual_studio_integration\\MSBuildExtensions\\"; + this->GlobalGenerator + ->GetPlatformToolsetCudaVSIntegrationSubdirString() + + "extras\\visual_studio_integration\\MSBuildExtensions\\"; Elem(e1, "Import") .Attribute("Project", std::move(cudaPath) + "CUDA " + diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 61ce154..a04338f 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -209,9 +209,9 @@ cmake::cmake(Role role, cmState::Mode mode) }; // The "c" extension MUST precede the "C" extension. - setupExts( - this->CLikeSourceFileExtensions, - { "c", "C", "c++", "cc", "cpp", "cxx", "cu", "mpp", "m", "M", "mm" }); + setupExts(this->CLikeSourceFileExtensions, + { "c", "C", "c++", "cc", "cpp", "cxx", "cu", "mpp", "m", "M", + "mm", "ixx", "cppm" }); setupExts(this->HeaderFileExtensions, { "h", "hh", "h++", "hm", "hpp", "hxx", "in", "txx" }); setupExts(this->CudaFileExtensions, { "cu" }); diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 0430afb..d6a20bc 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1424,6 +1424,7 @@ if(BUILD_TESTING) CURL Cups Doxygen + DevIL EnvModules EXPAT Fontconfig @@ -1696,7 +1697,7 @@ if(BUILD_TESTING) ${build_generator_args} --build-project ${import_name} --build-options - "-DCMAKE_PREFIX_PATH:PATH=${install_dir}/lib/cmake") + "-DCMAKE_PREFIX_PATH:PATH=${install_dir}") set_tests_properties(${import_test_name} PROPERTIES DEPENDS ${export_test_name}) list(APPEND TEST_BUILD_DIRS "${import_build_dir}") endfunction() diff --git a/Tests/FindDevIL/CMakeLists.txt b/Tests/FindDevIL/CMakeLists.txt new file mode 100644 index 0000000..d37d50f --- /dev/null +++ b/Tests/FindDevIL/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindDevIL.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindDevIL/Test" + "${CMake_BINARY_DIR}/Tests/FindDevIL/Test" + ${build_generator_args} + --build-project TestFindDevIL + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindDevIL/Test/CMakeLists.txt b/Tests/FindDevIL/Test/CMakeLists.txt new file mode 100644 index 0000000..c2c1322 --- /dev/null +++ b/Tests/FindDevIL/Test/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.1) +project(TestFindDevIL C) +include(CTest) + +find_package(DevIL) + +#FIXME: check version too. +# add_definitions( +# -DCMAKE_EXPECTED_SDL_VERSION_MAJOR=${SDL_VERSION_MAJOR} +# -DCMAKE_EXPECTED_SDL_VERSION_MINOR=${SDL_VERSION_MINOR} +# -DCMAKE_EXPECTED_SDL_VERSION_PATCH=${SDL_VERSION_PATCH}) + +add_executable(test_devil_var main.c) +target_include_directories(test_devil_var PRIVATE ${IL_INCLUDE_DIRS}) +target_link_libraries(test_devil_var PRIVATE ${IL_LIBRARIES}) +add_test(NAME test_devil_var COMMAND test_devil_var) + +add_executable(test_devil_il_tgt main.c) +target_link_libraries(test_devil_il_tgt DevIL::IL) +add_test(NAME test_devil_il_tgt COMMAND test_devil_il_tgt) + +add_executable(test_devil_ilu_tgt main_ilu.c) +target_link_libraries(test_devil_ilu_tgt DevIL::ILU) + +add_executable(test_devil_ilu_var main_ilu.c) +target_include_directories(test_devil_ilu_var PRIVATE ${IL_INCLUDE_DIRS} ${ILU_INCLUDE_DIRS}) +target_link_libraries(test_devil_ilu_var ${IL_LIBRARIES} ${ILU_LIBRARIES}) + +#FIXME: Check DevIL::ILUT target diff --git a/Tests/FindDevIL/Test/main.c b/Tests/FindDevIL/Test/main.c new file mode 100644 index 0000000..4a07087 --- /dev/null +++ b/Tests/FindDevIL/Test/main.c @@ -0,0 +1,10 @@ +#include <IL/il.h> + +int main() +{ + // Test 1 requires to link to the library. + ilInit(); + + ilShutDown(); + return 0; +} diff --git a/Tests/FindDevIL/Test/main_ilu.c b/Tests/FindDevIL/Test/main_ilu.c new file mode 100644 index 0000000..a9e7819 --- /dev/null +++ b/Tests/FindDevIL/Test/main_ilu.c @@ -0,0 +1,8 @@ +#include <IL/ilu.h> + +int main() +{ + // IL Utilities requires only initialization. + // Unlike main DevIL there are no shutdown function. + iluInit(); +} diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test10-result.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test10-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test10-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test10-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test10-stderr.txt index cee4516..2bd1cba 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test10-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test10-stderr.txt @@ -39,13 +39,4 @@ Generated_source6\.txt: # 1b # GENERATED = `1` Generated_source6\.txt: # 2a # GENERATED = `1` Generated_source6\.txt: # 2b # GENERATED = `1` Generated_source6\.txt: # 3a # GENERATED = `0` -Generated_source6\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test10\.cmake:[0-9]+ \(add_custom_target\): - Cannot find source file: - -[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test10-build/Generated_source4\.txt -Call Stack \(most recent call first\): - CMP0118-NEW-Test10\.cmake:[0-9]+ \(include\) - CMakeLists\.txt:[0-9]+ \(include\) -+ -CMake Generate step failed\. Build files cannot be regenerated correctly\.$ +Generated_source6\.txt: # 3b # GENERATED = `0`$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test11-result.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test11-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test11-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test11-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test11-stderr.txt index 422a3de..05b2353 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test11-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test11-stderr.txt @@ -52,29 +52,4 @@ Generated_source6\.txt: # 1b # GENERATED = `0` Generated_source6\.txt: # 2a # GENERATED = `0` Generated_source6\.txt: # 2b # GENERATED = `0` Generated_source6\.txt: # 3a # GENERATED = `0` -Generated_source6\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test11\.cmake:[0-9]+ \(add_custom_target\): - Cannot find source file: - -[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test11-build/Generated_source[4-6]\.txt -Call Stack \(most recent call first\): - CMP0118-NEW-Test11\.cmake:[0-9]+ \(include\) - CMakeLists\.txt:[0-9]+ \(include\) -+ -CMake Error at CMP0118-Common-Test11\.cmake:[0-9]+ \(add_custom_target\): - Cannot find source file: - -[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test11-build/Generated_source[4-6]\.txt -Call Stack \(most recent call first\): - CMP0118-NEW-Test11\.cmake:[0-9]+ \(include\) - CMakeLists\.txt:[0-9]+ \(include\) -+ -CMake Error at CMP0118-Common-Test11\.cmake:[0-9]+ \(add_custom_target\): - Cannot find source file: - -[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test11-build/Generated_source[4-6]\.txt -Call Stack \(most recent call first\): - CMP0118-NEW-Test11\.cmake:[0-9]+ \(include\) - CMakeLists\.txt:[0-9]+ \(include\) -+ -CMake Generate step failed\. Build files cannot be regenerated correctly\.$ +Generated_source6\.txt: # 3b # GENERATED = `0`$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test14-result.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test14-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test14-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test14-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test14-stderr.txt index 2f42f36..2bd1cba 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test14-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test14-stderr.txt @@ -39,13 +39,4 @@ Generated_source6\.txt: # 1b # GENERATED = `1` Generated_source6\.txt: # 2a # GENERATED = `1` Generated_source6\.txt: # 2b # GENERATED = `1` Generated_source6\.txt: # 3a # GENERATED = `0` -Generated_source6\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test14\.cmake:[0-9]+ \(add_custom_target\): - Cannot find source file: - -[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test14-build/Generated_source4\.txt -Call Stack \(most recent call first\): - CMP0118-NEW-Test14\.cmake:[0-9]+ \(include\) - CMakeLists\.txt:[0-9]+ \(include\) -+ -CMake Generate step failed\. Build files cannot be regenerated correctly\.$ +Generated_source6\.txt: # 3b # GENERATED = `0`$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test15-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test15-stderr.txt index 65bd577..3166f45 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test15-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test15-stderr.txt @@ -52,29 +52,4 @@ Generated_source6\.txt: # 1b # GENERATED = `0` Generated_source6\.txt: # 2a # GENERATED = `0` Generated_source6\.txt: # 2b # GENERATED = `0` Generated_source6\.txt: # 3a # GENERATED = `0` -Generated_source6\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test15\.cmake:[0-9]+ \(add_custom_target\): - Cannot find source file: - -[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test15-build/Generated_source[4-6]\.txt -Call Stack \(most recent call first\): - CMP0118-NEW-Test15\.cmake:[0-9]+ \(include\) - CMakeLists\.txt:[0-9]+ \(include\) -+ -CMake Error at CMP0118-Common-Test15\.cmake:[0-9]+ \(add_custom_target\): - Cannot find source file: - -[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test15-build/Generated_source[4-6]\.txt -Call Stack \(most recent call first\): - CMP0118-NEW-Test15\.cmake:[0-9]+ \(include\) - CMakeLists\.txt:[0-9]+ \(include\) -+ -CMake Error at CMP0118-Common-Test15\.cmake:[0-9]+ \(add_custom_target\): - Cannot find source file: - -[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test15-build/Generated_source[4-6]\.txt -Call Stack \(most recent call first\): - CMP0118-NEW-Test15\.cmake:[0-9]+ \(include\) - CMakeLists\.txt:[0-9]+ \(include\) -+ -CMake Generate step failed\. Build files cannot be regenerated correctly\.$ +Generated_source6\.txt: # 3b # GENERATED = `0`$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test6-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test6-stderr.txt index 17e2b4a..0c84cfe 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test6-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test6-stderr.txt @@ -33,13 +33,4 @@ Generated_source6\.txt: # 1b # GENERATED = `1` Generated_source6\.txt: # 2a # GENERATED = `1` Generated_source6\.txt: # 2b # GENERATED = `1` Generated_source6\.txt: # 3a # GENERATED = `0` -Generated_source6\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test6\.cmake:[0-9]+ \(add_custom_target\): - Cannot find source file: - -[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test6-build/Generated_source4\.txt -Call Stack \(most recent call first\): - CMP0118-NEW-Test6\.cmake:[0-9]+ \(include\) - CMakeLists\.txt:[0-9]+ \(include\) -+ -CMake Generate step failed\. Build files cannot be regenerated correctly\.$ +Generated_source6\.txt: # 3b # GENERATED = `0`$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test8-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test8-stderr.txt index 7f48bf0..f723875 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test8-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test8-stderr.txt @@ -33,13 +33,4 @@ Generated_source6\.txt: # 1b # GENERATED = `1` Generated_source6\.txt: # 2a # GENERATED = `1` Generated_source6\.txt: # 2b # GENERATED = `1` Generated_source6\.txt: # 3a # GENERATED = `0` -Generated_source6\.txt: # 3b # GENERATED = `0` -CMake Error at CMP0118-Common-Test8\.cmake:[0-9]+ \(add_custom_target\): - Cannot find source file: - -[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test8-build/Generated_source4\.txt -Call Stack \(most recent call first\): - CMP0118-NEW-Test8\.cmake:[0-9]+ \(include\) - CMakeLists\.txt:[0-9]+ \(include\) -+ -CMake Generate step failed\. Build files cannot be regenerated correctly\.$ +Generated_source6\.txt: # 3b # GENERATED = `0`$ diff --git a/Tests/RunCMake/CMP0118/CMakeLists.txt b/Tests/RunCMake/CMP0118/CMakeLists.txt index 0d30651..957fe03 100644 --- a/Tests/RunCMake/CMP0118/CMakeLists.txt +++ b/Tests/RunCMake/CMP0118/CMakeLists.txt @@ -1,4 +1,4 @@ cmake_minimum_required(VERSION 3.19) cmake_policy(SET CMP0115 NEW) project(${RunCMake_TEST} NONE) -include(${RunCMake_TEST}.cmake) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/CMP0118/GenInSubdir-Common.cmake b/Tests/RunCMake/CMP0118/GenInSubdir-Common.cmake new file mode 100644 index 0000000..6012c79 --- /dev/null +++ b/Tests/RunCMake/CMP0118/GenInSubdir-Common.cmake @@ -0,0 +1,2 @@ +add_custom_target(top) +add_subdirectory(GenInSubdir) diff --git a/Tests/RunCMake/CMP0118/GenInSubdir-NEW.cmake b/Tests/RunCMake/CMP0118/GenInSubdir-NEW.cmake new file mode 100644 index 0000000..373e73d --- /dev/null +++ b/Tests/RunCMake/CMP0118/GenInSubdir-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 NEW) +include(GenInSubdir-Common.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test8-result.txt b/Tests/RunCMake/CMP0118/GenInSubdir-OLD-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test8-result.txt +++ b/Tests/RunCMake/CMP0118/GenInSubdir-OLD-result.txt diff --git a/Tests/RunCMake/CMP0118/GenInSubdir-OLD-stderr.txt b/Tests/RunCMake/CMP0118/GenInSubdir-OLD-stderr.txt new file mode 100644 index 0000000..d3aa546 --- /dev/null +++ b/Tests/RunCMake/CMP0118/GenInSubdir-OLD-stderr.txt @@ -0,0 +1,8 @@ +^CMake Error at GenInSubdir-Common.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + + [^ +]*/Tests/RunCMake/CMP0118/GenInSubdir-OLD-build/GenInSubdir/sub.txt +Call Stack \(most recent call first\): + GenInSubdir-OLD.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CMP0118/GenInSubdir-OLD.cmake b/Tests/RunCMake/CMP0118/GenInSubdir-OLD.cmake new file mode 100644 index 0000000..48be27e --- /dev/null +++ b/Tests/RunCMake/CMP0118/GenInSubdir-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 OLD) +include(GenInSubdir-Common.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test6-result.txt b/Tests/RunCMake/CMP0118/GenInSubdir-WARN-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test6-result.txt +++ b/Tests/RunCMake/CMP0118/GenInSubdir-WARN-result.txt diff --git a/Tests/RunCMake/CMP0118/GenInSubdir-WARN-stderr.txt b/Tests/RunCMake/CMP0118/GenInSubdir-WARN-stderr.txt new file mode 100644 index 0000000..5eb8a34 --- /dev/null +++ b/Tests/RunCMake/CMP0118/GenInSubdir-WARN-stderr.txt @@ -0,0 +1,8 @@ +^CMake Error at GenInSubdir-Common.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + + [^ +]*/Tests/RunCMake/CMP0118/GenInSubdir-WARN-build/GenInSubdir/sub.txt +Call Stack \(most recent call first\): + GenInSubdir-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CMP0118/GenInSubdir-WARN.cmake b/Tests/RunCMake/CMP0118/GenInSubdir-WARN.cmake new file mode 100644 index 0000000..8e7e395 --- /dev/null +++ b/Tests/RunCMake/CMP0118/GenInSubdir-WARN.cmake @@ -0,0 +1,2 @@ + +include(GenInSubdir-Common.cmake) diff --git a/Tests/RunCMake/CMP0118/GenInSubdir/CMakeLists.txt b/Tests/RunCMake/CMP0118/GenInSubdir/CMakeLists.txt new file mode 100644 index 0000000..3f1ce8d --- /dev/null +++ b/Tests/RunCMake/CMP0118/GenInSubdir/CMakeLists.txt @@ -0,0 +1,9 @@ +add_custom_command( + OUTPUT sub.txt + COMMAND ${CMAKE_COMMAND} -E touch sub.txt + VERBATIM + ) +add_custom_target(gen DEPENDS sub.txt) + +add_dependencies(top gen) +target_sources(top PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/sub.txt) diff --git a/Tests/RunCMake/CMP0118/RunCMakeTest.cmake b/Tests/RunCMake/CMP0118/RunCMakeTest.cmake index 72064bd..f7f135e 100644 --- a/Tests/RunCMake/CMP0118/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0118/RunCMakeTest.cmake @@ -1,5 +1,9 @@ include(RunCMake) +run_cmake(GenInSubdir-OLD) +run_cmake(GenInSubdir-WARN) +run_cmake(GenInSubdir-NEW) + run_cmake(CMP0118-OLD-Test1) run_cmake(CMP0118-OLD-Test2) run_cmake(CMP0118-OLD-Test3) diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake index 75ed677..3aa791d 100644 --- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -12,8 +12,12 @@ if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[012456]") run_cmake(TestToolsetCudaVersionOnly) set(RunCMake_GENERATOR_TOOLSET "cuda=0.0") run_cmake(TestToolsetCudaVersionOnly) - set(RunCMake_GENERATOR_TOOLSET "cuda=C:\\dummy\\cuda") + set(RunCMake_GENERATOR_TOOLSET "cuda=${CMAKE_CURRENT_BINARY_DIR}/CudaStandaloneToolset") run_cmake(TestToolsetCudaPathOnly) + set(RunCMake_GENERATOR_TOOLSET "cuda=${CMAKE_CURRENT_BINARY_DIR}/CudaStandaloneToolset") + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/CudaStandaloneToolset/CUDAVisualStudioIntegration") + run_cmake(TestToolsetCudaPathOnlyOldLayout) + file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/CudaStandaloneToolset") if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[2456]") set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64") run_cmake(TestToolsetHostArchBoth) diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly-stderr.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly-stderr.txt index b17745f..5236787 100644 --- a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly-stderr.txt +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly-stderr.txt @@ -5,8 +5,8 @@ CMake Error at CMakeLists.txt:[0-9]+ \(project\): given toolset - cuda=C:\\dummy\\cuda\\ + cuda=.*/Tests/RunCMake/CudaStandaloneToolset\\ cannot detect Visual Studio integration files in path - C:/dummy/cuda/CUDAVisualStudioIntegration/extras/visual_studio_integration/MSBuildExtensions + .*/Tests/RunCMake/CudaStandaloneToolset/extras/visual_studio_integration/MSBuildExtensions diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test15-result.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnlyOldLayout-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test15-result.txt +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnlyOldLayout-result.txt diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnlyOldLayout-stderr.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnlyOldLayout-stderr.txt new file mode 100644 index 0000000..3ce79f8 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnlyOldLayout-stderr.txt @@ -0,0 +1,12 @@ +CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + Visual Studio .* + + given toolset + + cuda=.*/Tests/RunCMake/CudaStandaloneToolset\\ + + cannot detect Visual Studio integration files in path + + .*/Tests/RunCMake/CudaStandaloneToolset/CUDAVisualStudioIntegration/extras/visual_studio_integration/MSBuildExtensions diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnlyOldLayout.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnlyOldLayout.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnlyOldLayout.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") |