Skip to content

Commit 9f17eb8

Browse files
committed
Close
1 parent 1d8942a commit 9f17eb8

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

examples/conan_cmake/library/CMakeLists.txt

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ include(CMakePackageConfigHelpers)
1212
# Dependencies
1313
find_package(fmt REQUIRED)
1414

15-
# Library target with module support
1615
add_library(mathutils)
1716
add_library(mathutils::mathutils ALIAS mathutils)
1817

@@ -25,21 +24,10 @@ target_sources(mathutils
2524
target_compile_features(mathutils PUBLIC cxx_std_23)
2625
target_link_libraries(mathutils PUBLIC fmt::fmt)
2726

28-
# Installation
29-
install(TARGETS mathutils
30-
EXPORT mathutilsTargets
31-
FILE_SET CXX_MODULES DESTINATION ${CMAKE_INSTALL_LIBDIR}/cxx/miu
32-
)
33-
34-
install(EXPORT mathutilsTargets
35-
FILE mathutilsTargets.cmake
36-
NAMESPACE mathutils::
37-
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/mathutils
38-
)
39-
40-
# Package configuration
27+
# Generate package config files
4128
write_basic_package_version_file(
4229
mathutilsConfigVersion.cmake
30+
VERSION ${PROJECT_VERSION}
4331
COMPATIBILITY SameMajorVersion
4432
)
4533

@@ -49,7 +37,24 @@ configure_package_config_file(
4937
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/mathutils
5038
)
5139

52-
install(FILES
40+
install(
41+
TARGETS mathutils
42+
EXPORT mathutilsTargets
43+
FILE_SET CXX_MODULES
44+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/mathutils/src
45+
)
46+
47+
# Export and package configuration
48+
install(
49+
EXPORT mathutilsTargets
50+
FILE mathutilsTargets.cmake
51+
NAMESPACE mathutils::
52+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/mathutils
53+
CXX_MODULES_DIRECTORY cxx-modules
54+
)
55+
56+
install(
57+
FILES
5358
${CMAKE_CURRENT_BINARY_DIR}/mathutilsConfig.cmake
5459
${CMAKE_CURRENT_BINARY_DIR}/mathutilsConfigVersion.cmake
5560
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/mathutils

0 commit comments

Comments
 (0)