#
# module with partitions
#
add_library(mod3 SHARED)
# cmake-format: off
target_sources(
mod3
PRIVATE mod3/mod3price.cpp mod3/mod3io.cpp
PUBLIC FILE_SET cxx_modules3
TYPE CXX_MODULES
FILES
mod3/mod3.cppm
mod3/mod3customer.cppm # interface partition
mod3/mod3order.cppm # internal partition
)
# cmake-format: on
target_compile_features(mod3 PUBLIC cxx_std_20)
target_link_libraries(mod3 PUBLIC fmt::fmt)
if(CMAKE_SKIP_INSTALL_RULES AND CMAKE_BUILD_TYPE STREQUAL "Debug")
target_link_libraries(mod3 PUBLIC $<BUILD_INTERFACE:project_warnings project_options>)
endif()
add_executable(testmod3 mod3/testmod3.cpp)
target_link_libraries(testmod3 mod3)
add_test(NAME testmod3 COMMAND testmod3)
if(CMAKE_SKIP_INSTALL_RULES)
return()
endif()
# cmake-format: off
install(
TARGETS modsimple # TODO(CK) mod1 mod2
mod3
EXPORT mymodules
RUNTIME # Following options apply to runtime artifacts.
COMPONENT Runtime
LIBRARY # Following options apply to library artifacts.
COMPONENT Runtime #
NAMELINK_COMPONENT Development
ARCHIVE # Following options apply to archive artifacts.
COMPONENT Development
DESTINATION lib/static
CXX_MODULES_BMI # FIXME CXX_MODULES
COMPONENT Development
DESTINATION lib/bmi
FILE_SET # Following options apply to file set HEADERS.
HEADERS
COMPONENT Development
)
# cmake-format: on
install(
EXPORT mymodules
NAMESPACE modules
DESTINATION lib/mymodules
CXX_MODULES_DIRECTORY lib/bmi
)
I get the following error:
CMake Error at modules/CMakeLists.txt:109 (install):
install TARGETS target mod3 is exported but not all of its interface file
sets are installed
-- Configuring incomplete, errors occurred!
When targets with non-PRIVATEFILE_SETs are exported, the generated export files refer to these files. That is why they must be installed when the target itself is installed.
Note that BMI installation is possible, but nothing will do anything with them at the moment (reusing them is…a future endeavor that will likely need compiler assistance). I would avoid BMI installation for now.
Thanks Ben for the heads up. Is it still the same situation now (a year-ish later)? Should BMI installation (or to be precise, reusing/depending on it) still be avoided?