Skip to content

Commit e619449

Browse files
committed
attempt to emulate exemplar modules PR
1 parent 8000dfd commit e619449

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

CMakeLists.txt

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ project(
99
VERSION 0.0.1
1010
)
1111

12+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
13+
1214
# [CMAKE.SKIP_TESTS]
1315
option(
1416
BEMAN_SCOPE_BUILD_TESTS
@@ -29,10 +31,11 @@ option(
2931
${PROJECT_IS_TOP_LEVEL}
3032
)
3133

32-
add_library(beman.scope INTERFACE)
34+
add_library(beman.scope)
3335
add_library(beman::scope ALIAS beman.scope)
3436

3537
# gersemi: off
38+
3639
set_target_properties(
3740
beman.scope
3841
PROPERTIES
@@ -42,22 +45,31 @@ set_target_properties(
4245

4346
target_sources(
4447
beman.scope
45-
INTERFACE
48+
PUBLIC
4649
FILE_SET HEADERS
4750
BASE_DIRS include
4851
FILES include/beman/scope/scope.hpp
52+
PUBLIC
53+
FILE_SET CXX_MODULES
54+
BASE_DIRS include
55+
FILES include/beman/scope/beman.scope.cppm
4956
)
5057

58+
include(GNUInstallDirs)
59+
5160
install(
5261
TARGETS beman.scope
53-
EXPORT beman.scope-targets
5462
COMPONENT beman.scope
63+
EXPORT beman.scope-targets
64+
65+
FILE_SET CXX_MODULES
66+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
5567
FILE_SET HEADERS
5668
)
69+
5770
# gersemi: on
5871

5972
if(BEMAN_SCOPE_INSTALL_CONFIG_FILE_PACKAGE)
60-
include(GNUInstallDirs)
6173
include(CMakePackageConfigHelpers)
6274

6375
write_basic_package_version_file(
@@ -77,6 +89,7 @@ if(BEMAN_SCOPE_INSTALL_CONFIG_FILE_PACKAGE)
7789
EXPORT beman.scope-targets
7890
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/beman.scope
7991
NAMESPACE beman::
92+
CXX_MODULES_DIRECTORY cxx-modules
8093
COMPONENT beman.scope
8194
)
8295
endif()

tests/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@ message("Tests to be built: ${ALL_TESTNAMES}")
1515

1616
include(Catch)
1717

18+
add_executable(test.module)
19+
target_sources(test.module PRIVATE module.test.cpp)
20+
target_compile_features(test.module PRIVATE cxx_std_20)
21+
target_compile_options(test.module PRIVATE "-fmodules")
22+
# target_link_libraries(
23+
# test.module
24+
# PUBLIC FILE_SET TYPE CXX_MODULES include/beman/scope/beman.scope.cppm
25+
# PRIVATE Catch2::Catch2WithMain beman::scope
26+
# )
27+
# catch_discover_tests(test.module)
28+
29+
1830
foreach(testname ${ALL_TESTNAMES})
1931
add_executable(test.${testname})
2032
target_sources(test.${testname} PRIVATE ${testname}.test.cpp)

0 commit comments

Comments
 (0)