diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bc4dd84..6250908 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,7 +14,7 @@ repos: # CMake linting and formatting - repo: https://github.com/BlankSpruce/gersemi - rev: 0.22.3 + rev: 0.25.1 hooks: - id: gersemi name: CMake linting diff --git a/cmake/beman-install-library-config.cmake b/cmake/beman-install-library-config.cmake index c40959d..da4173e 100644 --- a/cmake/beman-install-library-config.cmake +++ b/cmake/beman-install-library-config.cmake @@ -64,11 +64,15 @@ function(beman_install_library name) set(package_name "${name}") list(GET name_parts -1 component_name) + include(GNUInstallDirs) + install( TARGETS "${target_name}" COMPONENT "${install_component_name}" EXPORT "${export_name}" FILE_SET HEADERS + FILE_SET CXX_MODULES + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${package_name}/modules ) set_target_properties( @@ -76,8 +80,6 @@ function(beman_install_library name) PROPERTIES EXPORT_NAME "${component_name}" ) - include(GNUInstallDirs) - # Determine the prefix for project-specific variables string(TOUPPER "${name}" project_prefix) string(REPLACE "." "_" project_prefix "${project_prefix}") @@ -158,6 +160,8 @@ function(beman_install_library name) DESTINATION "${package_install_dir}" NAMESPACE beman:: FILE "${config_targets_file}" + CXX_MODULES_DIRECTORY + cxx-modules COMPONENT "${install_component_name}" ) else() diff --git a/cmake/use-fetch-content.cmake b/cmake/use-fetch-content.cmake index 4ed4839..9ac69d3 100644 --- a/cmake/use-fetch-content.cmake +++ b/cmake/use-fetch-content.cmake @@ -15,8 +15,7 @@ message(TRACE "BemanExemplar_projectDir=\"${BemanExemplar_projectDir}\"") message(TRACE "BEMAN_EXEMPLAR_LOCKFILE=\"${BEMAN_EXEMPLAR_LOCKFILE}\"") file( - REAL_PATH - "${BEMAN_EXEMPLAR_LOCKFILE}" + REAL_PATH "${BEMAN_EXEMPLAR_LOCKFILE}" BemanExemplar_lockfile BASE_DIRECTORY "${BemanExemplar_projectDir}" EXPAND_TILDE @@ -38,8 +37,7 @@ function(BemanExemplar_provideDependency method package_name) # Get the "dependencies" field and store it in BemanExemplar_dependenciesObj string( - JSON - BemanExemplar_dependenciesObj + JSON BemanExemplar_dependenciesObj ERROR_VARIABLE BemanExemplar_error GET "${BemanExemplar_rootObj}" "dependencies" @@ -50,8 +48,7 @@ function(BemanExemplar_provideDependency method package_name) # Get the length of the libraries array and store it in BemanExemplar_dependenciesObj string( - JSON - BemanExemplar_numDependencies + JSON BemanExemplar_numDependencies ERROR_VARIABLE BemanExemplar_error LENGTH "${BemanExemplar_dependenciesObj}" ) @@ -73,8 +70,7 @@ function(BemanExemplar_provideDependency method package_name) # Get the dependency object at BemanExemplar_index # and store it in BemanExemplar_depObj string( - JSON - BemanExemplar_depObj + JSON BemanExemplar_depObj ERROR_VARIABLE BemanExemplar_error GET "${BemanExemplar_dependenciesObj}" "${BemanExemplar_index}" @@ -88,8 +84,7 @@ function(BemanExemplar_provideDependency method package_name) # Get the "name" field and store it in BemanExemplar_name string( - JSON - BemanExemplar_name + JSON BemanExemplar_name ERROR_VARIABLE BemanExemplar_error GET "${BemanExemplar_depObj}" "name" @@ -103,8 +98,7 @@ function(BemanExemplar_provideDependency method package_name) # Get the "package_name" field and store it in BemanExemplar_pkgName string( - JSON - BemanExemplar_pkgName + JSON BemanExemplar_pkgName ERROR_VARIABLE BemanExemplar_error GET "${BemanExemplar_depObj}" "package_name" @@ -118,8 +112,7 @@ function(BemanExemplar_provideDependency method package_name) # Get the "git_repository" field and store it in BemanExemplar_repo string( - JSON - BemanExemplar_repo + JSON BemanExemplar_repo ERROR_VARIABLE BemanExemplar_error GET "${BemanExemplar_depObj}" "git_repository" @@ -133,8 +126,7 @@ function(BemanExemplar_provideDependency method package_name) # Get the "git_tag" field and store it in BemanExemplar_tag string( - JSON - BemanExemplar_tag + JSON BemanExemplar_tag ERROR_VARIABLE BemanExemplar_error GET "${BemanExemplar_depObj}" "git_tag" @@ -149,14 +141,12 @@ function(BemanExemplar_provideDependency method package_name) if(method STREQUAL "FIND_PACKAGE") if(package_name STREQUAL BemanExemplar_pkgName) string( - APPEND - BemanExemplar_debug + APPEND BemanExemplar_debug "Redirecting find_package calls for ${BemanExemplar_pkgName} " "to FetchContent logic.\n" ) string( - APPEND - BemanExemplar_debug + APPEND BemanExemplar_debug "Fetching ${BemanExemplar_repo} at " "${BemanExemplar_tag} according to ${BemanExemplar_lockfile}." )