parent
3698acc303
commit
d7a23c874c
@ -1,2 +1,23 @@
|
||||
# Save this now so we can restore it before returning
|
||||
if(NOT DEFINED PACKAGE_PREFIX_DIR)
|
||||
list(APPEND _gasf_PACKAGE_PREFIX_DIR "<__CMAKE_UNDEFINED__>")
|
||||
elseif("${PACKAGE_PREFIX_DIR}" STREQUAL "")
|
||||
list(APPEND _gasf_PACKAGE_PREFIX_DIR "<__CMAKE_EMPTY__>")
|
||||
else()
|
||||
list(APPEND _gasf_PACKAGE_PREFIX_DIR "${PACKAGE_PREFIX_DIR}")
|
||||
endif()
|
||||
|
||||
@PACKAGE_INIT@
|
||||
@_branch_code@
|
||||
|
||||
# Restore PACKAGE_PREFIX_DIR
|
||||
list(LENGTH _gasf_PACKAGE_PREFIX_DIR _gasf_tmp)
|
||||
math(EXPR _gasf_tmp "${_gasf_tmp} - 1")
|
||||
list(GET _gasf_PACKAGE_PREFIX_DIR ${_gasf_tmp} PACKAGE_PREFIX_DIR)
|
||||
list(REMOVE_AT _gasf_PACKAGE_PREFIX_DIR ${_gasf_tmp})
|
||||
unset(_gasf_tmp)
|
||||
if("${PACKAGE_PREFIX_DIR}" STREQUAL "<__CMAKE_UNDEFINED__>")
|
||||
unset(PACKAGE_PREFIX_DIR)
|
||||
elseif("${PACKAGE_PREFIX_DIR}" STREQUAL "<__CMAKE_EMPTY__>")
|
||||
set(PACKAGE_PREFIX_DIR "")
|
||||
endif()
|
||||
|
@ -0,0 +1,3 @@
|
||||
(-- )?Hello from platform switch
|
||||
(-- )?Hello from arch switch
|
||||
(-- )?Hello from pkg_a
|
@ -0,0 +1,50 @@
|
||||
set(CMAKE_INSTALL_DATADIR share)
|
||||
set(SWITCH_DIR platform/cmake)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pkg_a-config.cmake.in [[
|
||||
@PACKAGE_INIT@
|
||||
include("@PACKAGE_SWITCH_DIR@/platform-switch.cmake")
|
||||
include("@PACKAGE_CMAKE_INSTALL_DATADIR@/pkg_a_included.cmake")
|
||||
]])
|
||||
configure_package_config_file(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/pkg_a-config.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/install/pkg_a-config.cmake
|
||||
INSTALL_DESTINATION .
|
||||
PATH_VARS CMAKE_INSTALL_DATADIR SWITCH_DIR
|
||||
)
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/install/${CMAKE_INSTALL_DATADIR}/pkg_a_included.cmake
|
||||
[[message(STATUS "Hello from pkg_a")]]
|
||||
)
|
||||
|
||||
# To expose re-using the same package prefix variable, we need to use a
|
||||
# different install prefix. This is really contrived and not representative of
|
||||
# what a package should do.
|
||||
generate_apple_platform_selection_file(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/install/platform/cmake/platform-switch.cmake
|
||||
INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/platform
|
||||
INSTALL_DESTINATION cmake
|
||||
MACOS_INCLUDE_FILE cmake/switch_included.cmake # relative to install prefix
|
||||
)
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/install/platform/cmake/switch_included.cmake
|
||||
[[
|
||||
message(STATUS "Hello from platform switch")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/../arch/cmake/arch-switch.cmake")
|
||||
]]
|
||||
)
|
||||
|
||||
generate_apple_architecture_selection_file(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/install/platform/arch/cmake/arch-switch.cmake
|
||||
INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/platform/arch
|
||||
INSTALL_DESTINATION cmake
|
||||
UNIVERSAL_ARCHITECTURES i386 x86_64 arm64 $(ARCHS_STANDARD)
|
||||
UNIVERSAL_INCLUDE_FILE cmake/switch_included.cmake # relative to install prefix
|
||||
)
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/install/platform/arch/cmake/switch_included.cmake
|
||||
[[message(STATUS "Hello from arch switch")]]
|
||||
)
|
||||
|
||||
find_package(pkg_a REQUIRED NO_DEFAULT_PATH
|
||||
PATHS ${CMAKE_CURRENT_BINARY_DIR}/install
|
||||
)
|
@ -0,0 +1,39 @@
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/check-json.cmake")
|
||||
|
||||
if (RunCMake_GENERATOR_IS_MULTI_CONFIG)
|
||||
set(have_file 0)
|
||||
foreach (CXXModules_config IN ITEMS Release Debug RelWithDebInfo MinSizeRel)
|
||||
if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-public.dir/${CXXModules_config}/CXXDependInfo.json")
|
||||
continue ()
|
||||
endif ()
|
||||
set(have_file 1)
|
||||
|
||||
set(CMAKE_BUILD_TYPE "${CXXModules_config}")
|
||||
|
||||
file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-public.dir/${CXXModules_config}/CXXDependInfo.json" actual_contents)
|
||||
file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoExportFilesystemSafe-public.json" expect_contents)
|
||||
check_json("${actual_contents}" "${expect_contents}")
|
||||
|
||||
file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-private.dir/${CXXModules_config}/CXXDependInfo.json" actual_contents)
|
||||
file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoExportFilesystemSafe-private.json" expect_contents)
|
||||
check_json("${actual_contents}" "${expect_contents}")
|
||||
endforeach ()
|
||||
|
||||
if (NOT have_file)
|
||||
list(APPEND RunCMake_TEST_FAILED
|
||||
"No recognized build configurations found.")
|
||||
endif ()
|
||||
else ()
|
||||
set(CXXModules_config "${CXXModules_default_build_type}")
|
||||
set(CMAKE_BUILD_TYPE "${CXXModules_default_build_type}")
|
||||
|
||||
file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-public.dir/CXXDependInfo.json" actual_contents)
|
||||
file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoExportFilesystemSafe-public.json" expect_contents)
|
||||
check_json("${actual_contents}" "${expect_contents}")
|
||||
|
||||
file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-private.dir/CXXDependInfo.json" actual_contents)
|
||||
file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoExportFilesystemSafe-private.json" expect_contents)
|
||||
check_json("${actual_contents}" "${expect_contents}")
|
||||
endif ()
|
||||
|
||||
string(REPLACE ";" "\n " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}")
|
@ -0,0 +1,84 @@
|
||||
# Fake out that we have dyndep; we only need to generate, not actually build
|
||||
# here.
|
||||
set(CMAKE_CXX_SCANDEP_SOURCE "")
|
||||
|
||||
enable_language(CXX)
|
||||
|
||||
if (NOT CMAKE_GENERATOR MATCHES "Ninja")
|
||||
message(FATAL_ERROR
|
||||
"This test requires a 'Ninja' generator to be used.")
|
||||
endif ()
|
||||
|
||||
add_library(ninja-exports-public)
|
||||
target_sources(ninja-exports-public
|
||||
PRIVATE
|
||||
sources/module-impl.cxx
|
||||
sources/module-internal-part-impl.cxx
|
||||
sources/module-part-impl.cxx
|
||||
sources/module-use.cxx
|
||||
PUBLIC
|
||||
FILE_SET modules TYPE CXX_MODULES
|
||||
BASE_DIRS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/sources"
|
||||
FILES
|
||||
sources/module.cxx
|
||||
sources/module-part.cxx
|
||||
FILE_SET internal_partitions TYPE CXX_MODULES FILES
|
||||
sources/module-internal-part.cxx)
|
||||
target_compile_features(ninja-exports-public
|
||||
PRIVATE
|
||||
cxx_std_20)
|
||||
set_property(TARGET ninja-exports-public
|
||||
PROPERTY EXPORT_NAME "with::public_")
|
||||
|
||||
install(TARGETS ninja-exports-public
|
||||
EXPORT exp
|
||||
FILE_SET modules
|
||||
DESTINATION "lib/cxx"
|
||||
COMPONENT "modules"
|
||||
FILE_SET internal_partitions
|
||||
DESTINATION "lib/cxx/internals"
|
||||
COMPONENT "modules-internal")
|
||||
|
||||
add_library(ninja-exports-private)
|
||||
target_sources(ninja-exports-private
|
||||
PRIVATE
|
||||
sources/module-impl.cxx
|
||||
sources/module-internal-part-impl.cxx
|
||||
sources/module-part-impl.cxx
|
||||
sources/module-use.cxx
|
||||
PRIVATE
|
||||
FILE_SET modules TYPE CXX_MODULES
|
||||
BASE_DIRS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/sources"
|
||||
FILES
|
||||
sources/module.cxx
|
||||
sources/module-part.cxx
|
||||
FILE_SET internal_partitions TYPE CXX_MODULES FILES
|
||||
sources/module-internal-part.cxx)
|
||||
target_compile_features(ninja-exports-private
|
||||
PRIVATE
|
||||
cxx_std_20)
|
||||
set_property(TARGET ninja-exports-private
|
||||
PROPERTY EXPORT_NAME "with::private_")
|
||||
|
||||
install(TARGETS ninja-exports-private
|
||||
EXPORT exp)
|
||||
|
||||
# Test multiple build exports.
|
||||
export(EXPORT exp
|
||||
FILE "${CMAKE_BINARY_DIR}/lib/cmake/export1/export1-targets.cmake"
|
||||
NAMESPACE export1::
|
||||
CXX_MODULES_DIRECTORY "cxx-modules")
|
||||
export(EXPORT exp
|
||||
FILE "${CMAKE_BINARY_DIR}/lib/cmake/export2/export2-targets.cmake"
|
||||
CXX_MODULES_DIRECTORY "cxx-modules")
|
||||
|
||||
# Test multiple install exports.
|
||||
install(EXPORT exp
|
||||
DESTINATION "lib/cmake/export1"
|
||||
NAMESPACE export1::
|
||||
CXX_MODULES_DIRECTORY "cxx-modules")
|
||||
install(EXPORT exp
|
||||
DESTINATION "lib/cmake/export2"
|
||||
CXX_MODULES_DIRECTORY "cxx-modules")
|
@ -0,0 +1,37 @@
|
||||
cmake_minimum_required(VERSION 3.24...3.28)
|
||||
project(cxx_modules_export_sepdir CXX)
|
||||
|
||||
include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
|
||||
|
||||
add_subdirectory(subdir)
|
||||
|
||||
install(TARGETS export_sepdir
|
||||
EXPORT CXXModules
|
||||
FILE_SET modules DESTINATION "lib/cxx/miu")
|
||||
export(EXPORT CXXModules
|
||||
NAMESPACE CXXModules::
|
||||
FILE "${CMAKE_CURRENT_BINARY_DIR}/export_sepdir-targets.cmake")
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/export_sepdir-config.cmake"
|
||||
"include(\"\${CMAKE_CURRENT_LIST_DIR}/export_sepdir-targets.cmake\")
|
||||
set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND 1)
|
||||
")
|
||||
|
||||
set(generator
|
||||
-G "${CMAKE_GENERATOR}")
|
||||
if (CMAKE_GENERATOR_TOOLSET)
|
||||
list(APPEND generator
|
||||
-T "${CMAKE_GENERATOR_TOOLSET}")
|
||||
endif ()
|
||||
if (CMAKE_GENERATOR_PLATFORM)
|
||||
list(APPEND generator
|
||||
-A "${CMAKE_GENERATOR_PLATFORM}")
|
||||
endif ()
|
||||
|
||||
add_test(NAME export_sepdir_build
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}"
|
||||
"-Dexpected_dir=${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
"-Dexport_sepdir_DIR=${CMAKE_CURRENT_BINARY_DIR}"
|
||||
${generator}
|
||||
-S "${CMAKE_CURRENT_SOURCE_DIR}/test"
|
||||
-B "${CMAKE_CURRENT_BINARY_DIR}/test")
|
@ -0,0 +1,9 @@
|
||||
add_library(export_sepdir STATIC)
|
||||
target_sources(export_sepdir
|
||||
PUBLIC
|
||||
FILE_SET modules TYPE CXX_MODULES
|
||||
BASE_DIRS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
FILES
|
||||
importable.cxx)
|
||||
target_compile_features(export_sepdir PUBLIC cxx_std_20)
|
@ -0,0 +1,6 @@
|
||||
export module importable;
|
||||
|
||||
export int from_import()
|
||||
{
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
cmake_minimum_required(VERSION 3.24...3.28)
|
||||
project(cxx_modules_library NONE)
|
||||
|
||||
find_package(export_sepdir REQUIRED)
|
||||
|
||||
if (NOT TARGET CXXModules::export_sepdir)
|
||||
message(FATAL_ERROR
|
||||
"Missing imported target")
|
||||
endif ()
|
||||
|
||||
get_property(modules TARGET CXXModules::export_sepdir
|
||||
PROPERTY "IMPORTED_CXX_MODULES_NOCONFIG")
|
||||
if (modules STREQUAL "")
|
||||
message(SEND_ERROR
|
||||
"Expected non-empty property value for IMPORTED_CXX_MODULES_NOCONFIG")
|
||||
endif ()
|
@ -0,0 +1,40 @@
|
||||
cmake_minimum_required(VERSION 3.24...3.28)
|
||||
project(cxx_modules_export_sepdir CXX)
|
||||
|
||||
include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
|
||||
|
||||
add_subdirectory(subdir)
|
||||
|
||||
install(TARGETS export_sepdir
|
||||
EXPORT CXXModules
|
||||
FILE_SET modules DESTINATION "lib/cxx/miu")
|
||||
install(EXPORT CXXModules
|
||||
NAMESPACE CXXModules::
|
||||
DESTINATION "lib/cmake/export_sepdir"
|
||||
FILE "export_sepdir-targets.cmake")
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/export_sepdir-config.cmake"
|
||||
"include(\"\${CMAKE_CURRENT_LIST_DIR}/export_sepdir-targets.cmake\")
|
||||
set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND 1)
|
||||
")
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/export_sepdir-config.cmake"
|
||||
DESTINATION "lib/cmake/export_sepdir")
|
||||
|
||||
set(generator
|
||||
-G "${CMAKE_GENERATOR}")
|
||||
if (CMAKE_GENERATOR_TOOLSET)
|
||||
list(APPEND generator
|
||||
-T "${CMAKE_GENERATOR_TOOLSET}")
|
||||
endif ()
|
||||
if (CMAKE_GENERATOR_PLATFORM)
|
||||
list(APPEND generator
|
||||
-A "${CMAKE_GENERATOR_PLATFORM}")
|
||||
endif ()
|
||||
|
||||
add_test(NAME export_sepdir_build
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}"
|
||||
"-Dexpected_dir=${CMAKE_INSTALL_PREFIX}/lib/cxx/miu"
|
||||
"-Dexport_sepdir_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/export_sepdir"
|
||||
${generator}
|
||||
-S "${CMAKE_CURRENT_SOURCE_DIR}/test"
|
||||
-B "${CMAKE_CURRENT_BINARY_DIR}/test")
|
@ -0,0 +1,9 @@
|
||||
add_library(export_sepdir STATIC)
|
||||
target_sources(export_sepdir
|
||||
PUBLIC
|
||||
FILE_SET modules TYPE CXX_MODULES
|
||||
BASE_DIRS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
FILES
|
||||
importable.cxx)
|
||||
target_compile_features(export_sepdir PUBLIC cxx_std_20)
|
@ -0,0 +1,6 @@
|
||||
export module importable;
|
||||
|
||||
export int from_import()
|
||||
{
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
cmake_minimum_required(VERSION 3.24...3.28)
|
||||
project(cxx_modules_library NONE)
|
||||
|
||||
find_package(export_sepdir REQUIRED)
|
||||
|
||||
if (NOT TARGET CXXModules::export_sepdir)
|
||||
message(FATAL_ERROR
|
||||
"Missing imported target")
|
||||
endif ()
|
||||
|
||||
get_property(modules TARGET CXXModules::export_sepdir
|
||||
PROPERTY "IMPORTED_CXX_MODULES_NOCONFIG")
|
||||
if (modules STREQUAL "")
|
||||
message(SEND_ERROR
|
||||
"Expected non-empty property value for IMPORTED_CXX_MODULES_NOCONFIG")
|
||||
endif ()
|
@ -0,0 +1,49 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(export_with_headers CXX)
|
||||
|
||||
include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
|
||||
|
||||
add_library(export_with_headers)
|
||||
target_sources(export_with_headers
|
||||
PUBLIC
|
||||
FILE_SET headers TYPE HEADERS
|
||||
BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
FILES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/subdir/header.h"
|
||||
PUBLIC
|
||||
FILE_SET modules TYPE CXX_MODULES
|
||||
FILES
|
||||
importable.cxx)
|
||||
target_compile_features(export_with_headers PUBLIC cxx_std_20)
|
||||
|
||||
install(TARGETS export_with_headers
|
||||
EXPORT CXXModules
|
||||
FILE_SET headers
|
||||
FILE_SET modules DESTINATION ${CMAKE_INSTALL_LIBDIR}/miu)
|
||||
export(EXPORT CXXModules
|
||||
NAMESPACE CXXModules::
|
||||
FILE "${CMAKE_CURRENT_BINARY_DIR}/export_with_headers-targets.cmake"
|
||||
CXX_MODULES_DIRECTORY "export_with_headers-cxx-modules")
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/export_with_headers-config.cmake"
|
||||
"include(\"\${CMAKE_CURRENT_LIST_DIR}/export_with_headers-targets.cmake\")
|
||||
set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND 1)
|
||||
")
|
||||
|
||||
set(generator
|
||||
-G "${CMAKE_GENERATOR}")
|
||||
if (CMAKE_GENERATOR_TOOLSET)
|
||||
list(APPEND generator
|
||||
-T "${CMAKE_GENERATOR_TOOLSET}")
|
||||
endif ()
|
||||
if (CMAKE_GENERATOR_PLATFORM)
|
||||
list(APPEND generator
|
||||
-A "${CMAKE_GENERATOR_PLATFORM}")
|
||||
endif ()
|
||||
|
||||
add_test(NAME export_with_headers_build
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}"
|
||||
"-Dexport_with_headers_DIR=${CMAKE_CURRENT_BINARY_DIR}"
|
||||
${generator}
|
||||
-S "${CMAKE_CURRENT_SOURCE_DIR}/test"
|
||||
-B "${CMAKE_CURRENT_BINARY_DIR}/test")
|
@ -0,0 +1,14 @@
|
||||
module;
|
||||
|
||||
#include <subdir/header.h>
|
||||
|
||||
#ifndef from_subdir_header_h
|
||||
# error "Define from header found"
|
||||
#endif
|
||||
|
||||
export module importable;
|
||||
|
||||
export int from_import()
|
||||
{
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define from_subdir_header_h 1
|
@ -0,0 +1,19 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(cxx_modules_library NONE)
|
||||
|
||||
find_package(export_with_headers REQUIRED)
|
||||
|
||||
if (NOT TARGET CXXModules::export_with_headers)
|
||||
message(FATAL_ERROR
|
||||
"Missing imported target")
|
||||
endif ()
|
||||
|
||||
get_property(iface_includes TARGET CXXModules::export_with_headers
|
||||
PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
|
||||
set(include_dir "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
cmake_path(GET include_dir PARENT_PATH include_dir)
|
||||
string(APPEND include_dir "/include")
|
||||
if (NOT iface_includes STREQUAL "${include_dir};$<BUILD_INTERFACE:${include_dir}>")
|
||||
message(FATAL_ERROR
|
||||
"Incorrect include interface for CXXModules::export_with_headers:\n ${iface_includes}")
|
||||
endif ()
|
@ -0,0 +1,51 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(export_with_headers CXX)
|
||||
|
||||
include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
|
||||
|
||||
add_library(export_with_headers)
|
||||
target_sources(export_with_headers
|
||||
PUBLIC
|
||||
FILE_SET headers TYPE HEADERS
|
||||
BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
FILES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/subdir/header.h"
|
||||
PUBLIC
|
||||
FILE_SET modules TYPE CXX_MODULES
|
||||
FILES
|
||||
importable.cxx)
|
||||
target_compile_features(export_with_headers PUBLIC cxx_std_20)
|
||||
|
||||
install(TARGETS export_with_headers
|
||||
EXPORT CXXModules
|
||||
FILE_SET headers
|
||||
FILE_SET modules DESTINATION lib/miu)
|
||||
install(EXPORT CXXModules
|
||||
NAMESPACE CXXModules::
|
||||
DESTINATION "lib/cmake/export_with_headers"
|
||||
FILE "export_with_headers-targets.cmake")
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/export_with_headers-config.cmake"
|
||||
"include(\"\${CMAKE_CURRENT_LIST_DIR}/export_with_headers-targets.cmake\")
|
||||
set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND 1)
|
||||
")
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/export_with_headers-config.cmake"
|
||||
DESTINATION "lib/cmake/export_with_headers")
|
||||
|
||||
set(generator
|
||||
-G "${CMAKE_GENERATOR}")
|
||||
if (CMAKE_GENERATOR_TOOLSET)
|
||||
list(APPEND generator
|
||||
-T "${CMAKE_GENERATOR_TOOLSET}")
|
||||
endif ()
|
||||
if (CMAKE_GENERATOR_PLATFORM)
|
||||
list(APPEND generator
|
||||
-A "${CMAKE_GENERATOR_PLATFORM}")
|
||||
endif ()
|
||||
|
||||
add_test(NAME export_with_headers_build
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}"
|
||||
"-Dexport_with_headers_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/export_with_headers"
|
||||
${generator}
|
||||
-S "${CMAKE_CURRENT_SOURCE_DIR}/test"
|
||||
-B "${CMAKE_CURRENT_BINARY_DIR}/test")
|
@ -0,0 +1,14 @@
|
||||
module;
|
||||
|
||||
#include <subdir/header.h>
|
||||
|
||||
#ifndef from_subdir_header_h
|
||||
# error "Define from header found"
|
||||
#endif
|
||||
|
||||
export module importable;
|
||||
|
||||
export int from_import()
|
||||
{
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define from_subdir_header_h 1
|
@ -0,0 +1,21 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(cxx_modules_library NONE)
|
||||
|
||||
find_package(export_with_headers REQUIRED)
|
||||
|
||||
if (NOT TARGET CXXModules::export_with_headers)
|
||||
message(FATAL_ERROR
|
||||
"Missing imported target")
|
||||
endif ()
|
||||
|
||||
get_property(iface_includes TARGET CXXModules::export_with_headers
|
||||
PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
|
||||
set(include_dir "${export_with_headers_DIR}")
|
||||
cmake_path(GET include_dir PARENT_PATH include_dir)
|
||||
cmake_path(GET include_dir PARENT_PATH include_dir)
|
||||
cmake_path(GET include_dir PARENT_PATH include_dir)
|
||||
string(APPEND include_dir "/include")
|
||||
if (NOT iface_includes STREQUAL "$<BUILD_INTERFACE:${include_dir}>")
|
||||
message(FATAL_ERROR
|
||||
"Incorrect include interface for CXXModules::export_with_headers:\n ${iface_includes}")
|
||||
endif ()
|
@ -0,0 +1,83 @@
|
||||
{
|
||||
"bmi-installation": null,
|
||||
"compiler-id": "<IGNORE>",
|
||||
"compiler-frontend-variant": "<IGNORE>",
|
||||
"compiler-simulate-id": "<IGNORE>",
|
||||
"config": "<CONFIG>",
|
||||
"cxx-modules": {
|
||||
"CMakeFiles/ninja-exports-private.dir<CONFIG_DIR>/sources/module-internal-part.cxx<OBJEXT>": {
|
||||
"bmi-only": false,
|
||||
"destination": null,
|
||||
"name": "internal_partitions",
|
||||
"relative-directory": "sources",
|
||||
"source": "<SOURCE_DIR>/sources/module-internal-part.cxx",
|
||||
"type": "CXX_MODULES",
|
||||
"visibility": "PRIVATE"
|
||||
},
|
||||
"CMakeFiles/ninja-exports-private.dir<CONFIG_DIR>/sources/module-part.cxx<OBJEXT>": {
|
||||
"bmi-only": false,
|
||||
"destination": null,
|
||||
"name": "modules",
|
||||
"relative-directory": "",
|
||||
"source": "<SOURCE_DIR>/sources/module-part.cxx",
|
||||
"type": "CXX_MODULES",
|
||||
"visibility": "PRIVATE"
|
||||
},
|
||||
"CMakeFiles/ninja-exports-private.dir<CONFIG_DIR>/sources/module.cxx<OBJEXT>": {
|
||||
"bmi-only": false,
|
||||
"destination": null,
|
||||
"name": "modules",
|
||||
"relative-directory": "",
|
||||
"source": "<SOURCE_DIR>/sources/module.cxx",
|
||||
"type": "CXX_MODULES",
|
||||
"visibility": "PRIVATE"
|
||||
}
|
||||
},
|
||||
"dir-cur-bld": "<BINARY_DIR>",
|
||||
"dir-cur-src": "<SOURCE_DIR>",
|
||||
"dir-top-bld": "<BINARY_DIR>",
|
||||
"dir-top-src": "<SOURCE_DIR>",
|
||||
"exports": [
|
||||
{
|
||||
"cxx-module-info-dir" : "cxx-modules",
|
||||
"destination" : "lib/cmake/export1",
|
||||
"export-name" : "with::private_",
|
||||
"export-prefix" : "<BINARY_DIR>/CMakeFiles/Export/d2e2673818fd2bd8c45c0e3ed0e38fcd",
|
||||
"filesystem-export-name" : "with_c_cprivate__",
|
||||
"install" : true,
|
||||
"namespace" : "export1::"
|
||||
},
|
||||
{
|
||||
"cxx-module-info-dir" : "cxx-modules",
|
||||
"destination" : "lib/cmake/export2",
|
||||
"export-name" : "with::private_",
|
||||
"filesystem-export-name" : "with_c_cprivate__",
|
||||
"export-prefix" : "<BINARY_DIR>/CMakeFiles/Export/28cd47cb4c96ad5cadaa3fb1b0201ae8",
|
||||
"install" : true,
|
||||
"namespace" : ""
|
||||
},
|
||||
{
|
||||
"cxx-module-info-dir" : "cxx-modules",
|
||||
"destination" : "<BINARY_DIR>/lib/cmake/export1",
|
||||
"export-name" : "with::private_",
|
||||
"export-prefix" : "<BINARY_DIR>/lib/cmake/export1",
|
||||
"filesystem-export-name" : "with_c_cprivate__",
|
||||
"install" : false,
|
||||
"namespace" : "export1::"
|
||||
},
|
||||
{
|
||||
"cxx-module-info-dir" : "cxx-modules",
|
||||
"destination" : "<BINARY_DIR>/lib/cmake/export2",
|
||||
"export-name" : "with::private_",
|
||||
"export-prefix" : "<BINARY_DIR>/lib/cmake/export2",
|
||||
"filesystem-export-name" : "with_c_cprivate__",
|
||||
"install" : false,
|
||||
"namespace" : ""
|
||||
}
|
||||
],
|
||||
"include-dirs": [],
|
||||
"language": "CXX",
|
||||
"forward-modules-from-target-dirs": [],
|
||||
"linked-target-dirs": [],
|
||||
"module-dir": "<BINARY_DIR>/CMakeFiles/ninja-exports-private.dir<CONFIG_DIR>"
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
{
|
||||
"bmi-installation": null,
|
||||
"compiler-id": "<IGNORE>",
|
||||
"compiler-frontend-variant": "<IGNORE>",
|
||||
"compiler-simulate-id": "<IGNORE>",
|
||||
"config": "<CONFIG>",
|
||||
"cxx-modules": {
|
||||
"CMakeFiles/ninja-exports-public.dir<CONFIG_DIR>/sources/module-internal-part.cxx<OBJEXT>": {
|
||||
"bmi-only": false,
|
||||
"destination": "lib/cxx/internals",
|
||||
"name": "internal_partitions",
|
||||
"relative-directory": "sources",
|
||||
"source": "<SOURCE_DIR>/sources/module-internal-part.cxx",
|
||||
"type": "CXX_MODULES",
|
||||
"visibility": "PUBLIC"
|
||||
},
|
||||
"CMakeFiles/ninja-exports-public.dir<CONFIG_DIR>/sources/module-part.cxx<OBJEXT>": {
|
||||
"bmi-only": false,
|
||||
"destination": "lib/cxx",
|
||||
"name": "modules",
|
||||
"relative-directory": "",
|
||||
"source": "<SOURCE_DIR>/sources/module-part.cxx",
|
||||
"type": "CXX_MODULES",
|
||||
"visibility": "PUBLIC"
|
||||
},
|
||||
"CMakeFiles/ninja-exports-public.dir<CONFIG_DIR>/sources/module.cxx<OBJEXT>": {
|
||||
"bmi-only": false,
|
||||
"destination": "lib/cxx",
|
||||
"name": "modules",
|
||||
"relative-directory": "",
|
||||
"source": "<SOURCE_DIR>/sources/module.cxx",
|
||||
"type": "CXX_MODULES",
|
||||
"visibility": "PUBLIC"
|
||||
}
|
||||
},
|
||||
"dir-cur-bld": "<BINARY_DIR>",
|
||||
"dir-cur-src": "<SOURCE_DIR>",
|
||||
"dir-top-bld": "<BINARY_DIR>",
|
||||
"dir-top-src": "<SOURCE_DIR>",
|
||||
"exports": [
|
||||
{
|
||||
"cxx-module-info-dir" : "cxx-modules",
|
||||
"destination" : "lib/cmake/export1",
|
||||
"export-name" : "with::public_",
|
||||
"export-prefix" : "<BINARY_DIR>/CMakeFiles/Export/d2e2673818fd2bd8c45c0e3ed0e38fcd",
|
||||
"filesystem-export-name" : "with_c_cpublic__",
|
||||
"install" : true,
|
||||
"namespace" : "export1::"
|
||||
},
|
||||
{
|
||||
"cxx-module-info-dir" : "cxx-modules",
|
||||
"destination" : "lib/cmake/export2",
|
||||
"export-name" : "with::public_",
|
||||
"export-prefix" : "<BINARY_DIR>/CMakeFiles/Export/28cd47cb4c96ad5cadaa3fb1b0201ae8",
|
||||
"filesystem-export-name" : "with_c_cpublic__",
|
||||
"install" : true,
|
||||
"namespace" : ""
|
||||
},
|
||||
{
|
||||
"cxx-module-info-dir" : "cxx-modules",
|
||||
"destination" : "<BINARY_DIR>/lib/cmake/export1",
|
||||
"export-name" : "with::public_",
|
||||
"export-prefix" : "<BINARY_DIR>/lib/cmake/export1",
|
||||
"filesystem-export-name" : "with_c_cpublic__",
|
||||
"install" : false,
|
||||
"namespace" : "export1::"
|
||||
},
|
||||
{
|
||||
"cxx-module-info-dir" : "cxx-modules",
|
||||
"destination" : "<BINARY_DIR>/lib/cmake/export2",
|
||||
"export-name" : "with::public_",
|
||||
"export-prefix" : "<BINARY_DIR>/lib/cmake/export2",
|
||||
"filesystem-export-name" : "with_c_cpublic__",
|
||||
"install" : false,
|
||||
"namespace" : ""
|
||||
}
|
||||
],
|
||||
"include-dirs": [],
|
||||
"language": "CXX",
|
||||
"forward-modules-from-target-dirs": [],
|
||||
"linked-target-dirs": [],
|
||||
"module-dir": "<BINARY_DIR>/CMakeFiles/ninja-exports-public.dir<CONFIG_DIR>"
|
||||
}
|
Loading…
Reference in new issue