diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2023-10-16 17:57:54 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2023-10-16 17:57:54 (GMT) |
commit | 0f36156740aaea82795444c8468fbfd5dc1e3810 (patch) | |
tree | 793efb3ddb7553621e59915ddecc76cc839c5a90 /Tests | |
parent | 7080b4ae8354b9e8deada0f35ff02a1bc1cc13a7 (diff) | |
download | CMake-0f36156740aaea82795444c8468fbfd5dc1e3810.zip CMake-0f36156740aaea82795444c8468fbfd5dc1e3810.tar.gz CMake-0f36156740aaea82795444c8468fbfd5dc1e3810.tar.bz2 |
cxxmodules: include `INCLUDES DESTINATION` directories
These paths are added outside the normal property management mechanisms.
Shuttle the value to the C++ module export as needed.
Fixes: #25289
Diffstat (limited to 'Tests')
6 files changed, 29 insertions, 4 deletions
diff --git a/Tests/RunCMake/CXXModules/examples/export-include-directories-build/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-include-directories-build/CMakeLists.txt index 560994e..dd35c1f 100644 --- a/Tests/RunCMake/CXXModules/examples/export-include-directories-build/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-include-directories-build/CMakeLists.txt @@ -4,7 +4,8 @@ project(cxx_modules_export_include_directories CXX) include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") add_library(export_include_directories STATIC - include/include.h) + include/include.h + includes/includes.h) target_sources(export_include_directories PRIVATE forward.cxx @@ -25,7 +26,8 @@ target_sources(export_include_directories target_compile_features(export_include_directories PUBLIC cxx_std_20) target_include_directories(export_include_directories PRIVATE - "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>") + "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>" + "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/includes>") add_library(no_modules STATIC no_modules.cxx) diff --git a/Tests/RunCMake/CXXModules/examples/export-include-directories-build/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-include-directories-build/importable.cxx index 6a1d83e..2c29683 100644 --- a/Tests/RunCMake/CXXModules/examples/export-include-directories-build/importable.cxx +++ b/Tests/RunCMake/CXXModules/examples/export-include-directories-build/importable.cxx @@ -6,6 +6,12 @@ module; # error "include define not found" #endif +#include "includes/includes.h" + +#ifndef includes_h_included +# error "includes define not found" +#endif + export module importable; extern "C++" { diff --git a/Tests/RunCMake/CXXModules/examples/export-include-directories-build/includes/includes.h b/Tests/RunCMake/CXXModules/examples/export-include-directories-build/includes/includes.h new file mode 100644 index 0000000..96bf33b --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-include-directories-build/includes/includes.h @@ -0,0 +1,3 @@ +#pragma once + +#define includes_h_included diff --git a/Tests/RunCMake/CXXModules/examples/export-include-directories-install/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-include-directories-install/CMakeLists.txt index 3d4e687..3e447f5 100644 --- a/Tests/RunCMake/CXXModules/examples/export-include-directories-install/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-include-directories-install/CMakeLists.txt @@ -4,7 +4,8 @@ project(cxx_modules_export_include_directories CXX) include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") add_library(export_include_directories STATIC - include/include.h) + include/include.h + includes/includes.h) target_sources(export_include_directories PRIVATE forward.cxx @@ -26,15 +27,19 @@ target_compile_features(export_include_directories PUBLIC cxx_std_20) target_include_directories(export_include_directories PRIVATE "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>" + "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/includes>" "$<INSTALL_INTERFACE:include>") add_library(no_modules STATIC no_modules.cxx) install(TARGETS export_include_directories no_modules EXPORT CXXModules - FILE_SET modules DESTINATION "lib/cxx/miu") + FILE_SET modules DESTINATION "lib/cxx/miu" + INCLUDES DESTINATION "elsewhere") install(DIRECTORY include DESTINATION "include") +install(DIRECTORY includes + DESTINATION "elsewhere") install(EXPORT CXXModules NAMESPACE CXXModules:: DESTINATION "lib/cmake/export_include_directories" diff --git a/Tests/RunCMake/CXXModules/examples/export-include-directories-install/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-include-directories-install/importable.cxx index 6a1d83e..2c29683 100644 --- a/Tests/RunCMake/CXXModules/examples/export-include-directories-install/importable.cxx +++ b/Tests/RunCMake/CXXModules/examples/export-include-directories-install/importable.cxx @@ -6,6 +6,12 @@ module; # error "include define not found" #endif +#include "includes/includes.h" + +#ifndef includes_h_included +# error "includes define not found" +#endif + export module importable; extern "C++" { diff --git a/Tests/RunCMake/CXXModules/examples/export-include-directories-install/includes/includes.h b/Tests/RunCMake/CXXModules/examples/export-include-directories-install/includes/includes.h new file mode 100644 index 0000000..96bf33b --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/export-include-directories-install/includes/includes.h @@ -0,0 +1,3 @@ +#pragma once + +#define includes_h_included |