From ebb7f70aec8786b8dbb91d0cf859daf6582195ad Mon Sep 17 00:00:00 2001 From: Justen Di Ruscio Date: Sun, 10 Mar 2024 16:47:18 -0300 Subject: [PATCH] use custom role to link module sources to github --- jgd-cmake-modules/JcmAddExecutable.cmake | 2 ++ jgd-cmake-modules/JcmAddLibrary.cmake | 2 ++ jgd-cmake-modules/JcmAddOption.cmake | 2 ++ jgd-cmake-modules/JcmAddTestExecutable.cmake | 2 ++ jgd-cmake-modules/JcmAllModules.cmake | 2 ++ jgd-cmake-modules/JcmBasicPackageConfig.cmake | 2 ++ jgd-cmake-modules/JcmCanonicalStructure.cmake | 2 ++ jgd-cmake-modules/JcmConfigureFiles.cmake | 19 ++++++++++++++----- .../JcmDefaultCompileOptions.cmake | 2 ++ jgd-cmake-modules/JcmExpandDirectories.cmake | 5 +++-- jgd-cmake-modules/JcmFileNaming.cmake | 2 ++ jgd-cmake-modules/JcmHeaderFileSet.cmake | 2 ++ .../JcmInstallConfigFilePackage.cmake | 2 ++ .../JcmListTransformations.cmake | 2 ++ jgd-cmake-modules/JcmParseArguments.cmake | 2 ++ jgd-cmake-modules/JcmSetupProject.cmake | 2 ++ .../JcmSourceSubdirectories.cmake | 16 +++++++++++----- jgd-cmake-modules/JcmStandardDirs.cmake | 2 ++ jgd-cmake-modules/JcmSymlinks.cmake | 2 ++ jgd-cmake-modules/JcmTargetNaming.cmake | 2 ++ jgd-cmake-modules/JcmTargetSources.cmake | 2 ++ .../find-modules/FindClangFormat.cmake | 4 +++- .../find-modules/FindSphinx.cmake | 5 ++++- 23 files changed, 71 insertions(+), 14 deletions(-) diff --git a/jgd-cmake-modules/JcmAddExecutable.cmake b/jgd-cmake-modules/JcmAddExecutable.cmake index 7becea7..cbe4cd3 100644 --- a/jgd-cmake-modules/JcmAddExecutable.cmake +++ b/jgd-cmake-modules/JcmAddExecutable.cmake @@ -5,6 +5,8 @@ include_guard() JcmAddExecutable ---------------- +:github:`JcmAddExecutable` + #]=======================================================================] include(JcmParseArguments) diff --git a/jgd-cmake-modules/JcmAddLibrary.cmake b/jgd-cmake-modules/JcmAddLibrary.cmake index c4901c9..5675139 100644 --- a/jgd-cmake-modules/JcmAddLibrary.cmake +++ b/jgd-cmake-modules/JcmAddLibrary.cmake @@ -5,6 +5,8 @@ include_guard() JcmAddLibrary ------------- +:github:`JcmAddLibrary` + #]=======================================================================] include(JcmParseArguments) diff --git a/jgd-cmake-modules/JcmAddOption.cmake b/jgd-cmake-modules/JcmAddOption.cmake index 7675ad8..19a60ab 100644 --- a/jgd-cmake-modules/JcmAddOption.cmake +++ b/jgd-cmake-modules/JcmAddOption.cmake @@ -5,6 +5,8 @@ include_guard() JcmAddOption ------------ +:github:`JcmAddOption` + #]=======================================================================] include(JcmParseArguments) diff --git a/jgd-cmake-modules/JcmAddTestExecutable.cmake b/jgd-cmake-modules/JcmAddTestExecutable.cmake index b6843fb..096db4f 100644 --- a/jgd-cmake-modules/JcmAddTestExecutable.cmake +++ b/jgd-cmake-modules/JcmAddTestExecutable.cmake @@ -5,6 +5,8 @@ include_guard() JcmAddTestExecutable -------------------- +:github:`JcmAddTestExecutable` + #]=======================================================================] include(JcmParseArguments) diff --git a/jgd-cmake-modules/JcmAllModules.cmake b/jgd-cmake-modules/JcmAllModules.cmake index 60cce8c..cbd710b 100644 --- a/jgd-cmake-modules/JcmAllModules.cmake +++ b/jgd-cmake-modules/JcmAllModules.cmake @@ -5,6 +5,8 @@ include_guard() JcmAllModules ------------- +:github:`JcmAllModules` + When included, includes all of JCM's CMake modules, excluding any `Find Modules `_. diff --git a/jgd-cmake-modules/JcmBasicPackageConfig.cmake b/jgd-cmake-modules/JcmBasicPackageConfig.cmake index 6131953..8e73deb 100644 --- a/jgd-cmake-modules/JcmBasicPackageConfig.cmake +++ b/jgd-cmake-modules/JcmBasicPackageConfig.cmake @@ -3,6 +3,8 @@ JcmBasicPackageConfig --------------------- +:github:`JcmBasicPackageConfig` + Provides macros to create `Config-file Packages `_. Offers the :cmake:command:`jcm_basic_package_config` macro for top-level config-files, and the diff --git a/jgd-cmake-modules/JcmCanonicalStructure.cmake b/jgd-cmake-modules/JcmCanonicalStructure.cmake index 4c59089..fe7ae27 100644 --- a/jgd-cmake-modules/JcmCanonicalStructure.cmake +++ b/jgd-cmake-modules/JcmCanonicalStructure.cmake @@ -14,6 +14,8 @@ include_guard() JcmCanonicalStructure --------------------- +:github:`JcmCanonicalStructure` + Specifications in `Canonical Project Structure`_, implemented in CMake. This modules concerns itself with source subdirectories, include directories, the 'lib' prefix, and file extensions. Actual file naming is implemented in *JcmFileNaming*, which uses the file extensions defined here. diff --git a/jgd-cmake-modules/JcmConfigureFiles.cmake b/jgd-cmake-modules/JcmConfigureFiles.cmake index 2d359bb..515e4a1 100644 --- a/jgd-cmake-modules/JcmConfigureFiles.cmake +++ b/jgd-cmake-modules/JcmConfigureFiles.cmake @@ -5,6 +5,8 @@ include_guard() JcmConfigureFiles ----------------- +:github:`JcmConfigureFiles` + Use-case specific configure functions, like CMake's :cmake:command:`configure_file` (`link `_), but with features for their respective use-case. @@ -150,13 +152,13 @@ jcm_configure_file Configures the file specified by :cmake:variable:`IN_FILE`, just like CMake's :cmake:command:`configure_file`, but follows JCM's input-file naming conventions, has richer error -checks and messages, and uses *@* uses substitution only. +checks and messages, uses *@* uses substitution only. The output file will be computed by removing the file extension :cmake:variable:`JCM_IN_FILE_EXTENSION` from :cmake:variable:`IN_FILE` and configuring the file to :cmake:variable:`DEST_DIR` (default :cmake:variable:`CMAKE_CURRENT_BINARY_DIR`), replacing `@` -variables, only. Like :cmake:command:`configure_file`, relative input paths are treated with -respect to :cmake:variable:`CMAKE_CURRENT_SOURCE_DIR`. +variables, only. Like :cmake:command:`configure_file`, relative input paths are treated with respect +to :cmake:variable:`CMAKE_CURRENT_SOURCE_DIR`. Use this function when configuring various files for which there is not a specific *configure* function for, such as headers and sources. @@ -194,12 +196,19 @@ Examples DEST_DIR "gen" # WRT CMAKE_CURRENT_BINARY_DIR OUT_FILE_VAR generated_file) +.. code-block:: cmake + + jcm_configure_file( + IN_FILE my_config.hpp.in # WRT CMAKE_CURRENT_SOURCE_DIR + DEST_DIR "gen" # WRT CMAKE_CURRENT_BINARY_DIR + OUT_FILE_VAR generated_file) + -------------------------------------------------------------------------- #]=======================================================================] function(jcm_configure_file) jcm_parse_arguments( - ONE_VALUE_KEYWORDS "IN_FILE" "OUT_FILE_VAR" "DEST_DIR" + ONE_VALUE_KEYWORDS "IN_FILE" "DEST_DIR" "OUT_FILE_VAR" REQUIRES_ALL "IN_FILE" ARGUMENTS "${ARGN}") @@ -246,7 +255,7 @@ function(jcm_configure_file) string(REGEX REPLACE "${JCM_IN_FILE_REGEX}" "" out_file_name "${in_file_name}") configure_file("${ARGS_IN_FILE}" "${out_file_name}" @ONLY) - # Out Var + # Out Vars if(DEFINED ARGS_OUT_FILE_VAR) set(${ARGS_OUT_FILE_VAR} "${ARGS_DEST_DIR}/${out_file_name}" PARENT_SCOPE) endif() diff --git a/jgd-cmake-modules/JcmDefaultCompileOptions.cmake b/jgd-cmake-modules/JcmDefaultCompileOptions.cmake index d049f00..76b06d3 100644 --- a/jgd-cmake-modules/JcmDefaultCompileOptions.cmake +++ b/jgd-cmake-modules/JcmDefaultCompileOptions.cmake @@ -5,6 +5,8 @@ include_guard() JcmDefaultCompileOptions ------------------------- +:github:`JcmDefaultCompileOptions` + Defines variables with default compile options for common compilers. These are used to initialize the `COMPILE_OPTIONS` properties when library or executable targets are created with JCM functions. Of course, like any of the defaults introduced by JCM, these can easily be overridden on the target diff --git a/jgd-cmake-modules/JcmExpandDirectories.cmake b/jgd-cmake-modules/JcmExpandDirectories.cmake index 60a5bd6..dd40085 100644 --- a/jgd-cmake-modules/JcmExpandDirectories.cmake +++ b/jgd-cmake-modules/JcmExpandDirectories.cmake @@ -5,6 +5,8 @@ include_guard() JcmExpandDirectories -------------------- +:github:`JcmExpandDirectories` + #]=======================================================================] include(JcmParseArguments) @@ -21,8 +23,7 @@ jcm_expand_directories jcm_expand_directories( OUT_VAR GLOB - PATHS ... - ) + PATHS ...) For each path in :cmake:variable:`PATHS`, if the path is a directory, the enclosed files matching diff --git a/jgd-cmake-modules/JcmFileNaming.cmake b/jgd-cmake-modules/JcmFileNaming.cmake index cd3dde5..d95db7e 100644 --- a/jgd-cmake-modules/JcmFileNaming.cmake +++ b/jgd-cmake-modules/JcmFileNaming.cmake @@ -3,6 +3,8 @@ JcmFileNaming ------------- +:github:`JcmFileNaming` + Provides variables and functions to help enforce file naming conventions. For each of the enabled languages at the point of inclusion, as per the global `ENABLED_LANGUAGES` diff --git a/jgd-cmake-modules/JcmHeaderFileSet.cmake b/jgd-cmake-modules/JcmHeaderFileSet.cmake index 6281e11..af20dd4 100644 --- a/jgd-cmake-modules/JcmHeaderFileSet.cmake +++ b/jgd-cmake-modules/JcmHeaderFileSet.cmake @@ -5,6 +5,8 @@ include_guard() JcmHeaderFileSet ---------------- +:github:`JcmHeaderFileSet` + #]=======================================================================] include(JcmParseArguments) diff --git a/jgd-cmake-modules/JcmInstallConfigFilePackage.cmake b/jgd-cmake-modules/JcmInstallConfigFilePackage.cmake index 1415103..f0470e0 100644 --- a/jgd-cmake-modules/JcmInstallConfigFilePackage.cmake +++ b/jgd-cmake-modules/JcmInstallConfigFilePackage.cmake @@ -5,6 +5,8 @@ include_guard() JcmInstallConfigFilePackage --------------------------- +:github:`JcmInstallConfigFilePackage` + #]=======================================================================] include(JcmParseArguments) diff --git a/jgd-cmake-modules/JcmListTransformations.cmake b/jgd-cmake-modules/JcmListTransformations.cmake index d879416..a2b4d37 100644 --- a/jgd-cmake-modules/JcmListTransformations.cmake +++ b/jgd-cmake-modules/JcmListTransformations.cmake @@ -8,6 +8,8 @@ include(JcmTargetNaming) JcmListTransformations ---------------------- +:github:`JcmListTransformations` + #]=======================================================================] #[=======================================================================[.rst: diff --git a/jgd-cmake-modules/JcmParseArguments.cmake b/jgd-cmake-modules/JcmParseArguments.cmake index 98c07c0..2cc9ffc 100644 --- a/jgd-cmake-modules/JcmParseArguments.cmake +++ b/jgd-cmake-modules/JcmParseArguments.cmake @@ -5,6 +5,8 @@ include_guard() JcmParseArguments ----------------- +:github:`JcmParseArguments` + #]=======================================================================] include(CMakeParseArguments) diff --git a/jgd-cmake-modules/JcmSetupProject.cmake b/jgd-cmake-modules/JcmSetupProject.cmake index 33d55a1..21278f2 100644 --- a/jgd-cmake-modules/JcmSetupProject.cmake +++ b/jgd-cmake-modules/JcmSetupProject.cmake @@ -5,6 +5,8 @@ include_guard() JcmSetupProject ---------------- +:github:`JcmSetupProject` + Offers utilities to properly setup a CMake project for consumption as both a sub-project and a binary package. Creates target component, *COMPONENT*, and defines macro :cmake:command:`jcm_setup_project` used to setup a CMake project. diff --git a/jgd-cmake-modules/JcmSourceSubdirectories.cmake b/jgd-cmake-modules/JcmSourceSubdirectories.cmake index 4971fcf..ff3f2d3 100644 --- a/jgd-cmake-modules/JcmSourceSubdirectories.cmake +++ b/jgd-cmake-modules/JcmSourceSubdirectories.cmake @@ -5,6 +5,8 @@ include_guard() JcmSourceSubdirectories ----------------------- +:github:`JcmSourceSubdirectories` + #]=======================================================================] include(JcmParseArguments) @@ -309,12 +311,16 @@ function(jcm_collect_subdirectory_targets) REQUIRES_ALL "OUT_VAR" ARGUMENTS "${ARGN}") + if(NOT DEFINED ARGS_START_DIR) + set(ARGS_START_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + endif() + + # EXISTS and IS_DIRECTORY only valid for full paths. Must first expand START_DIR for argument + # validation + cmake_path(ABSOLUTE_PATH ARGS_START_DIR NORMALIZE BASE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") if(NOT EXISTS "${ARGS_START_DIR}") message(FATAL_ERROR "The 'START_DIR' provided to ${CMAKE_CURRENT_FUNCTION} does not exist: '${ARGS_START_DIR}'") - endif() - if(NOT DEFINED ARGS_START_DIR) - set(ARGS_START_DIR "${CMAKE_CURRENT_SOURCE_DIR}") elseif(NOT IS_DIRECTORY "${ARGS_START_DIR}") message(FATAL_ERROR "The 'START_DIR' provided to ${CMAKE_CURRENT_FUNCTION} does not refer to a directory: " @@ -327,12 +333,12 @@ function(jcm_collect_subdirectory_targets) if(NOT DEFINED ARGS_EXCLUDE_DIRECTORY_REGEX OR NOT "${directory}" MATCHES "${ARGS_EXCLUDE_DIRECTORY_REGEX}") - get_property(current_targets DIRECTORY ${directory} PROPERTY BUILDSYSTEM_TARGETS) + get_property(current_targets DIRECTORY "${directory}" PROPERTY BUILDSYSTEM_TARGETS) list(APPEND targets ${current_targets}) endif() # SUBDIRECTORIES property is read-only & populated by CMake with absolute, native paths - get_property(subdirs DIRECTORY ${directory} PROPERTY SUBDIRECTORIES) + get_property(subdirs DIRECTORY "${directory}" PROPERTY SUBDIRECTORIES) foreach(subdir IN LISTS subdirs) impl(${subdir} subdir_targets) list(APPEND targets ${subdir_targets}) diff --git a/jgd-cmake-modules/JcmStandardDirs.cmake b/jgd-cmake-modules/JcmStandardDirs.cmake index 27c6077..9405aa7 100644 --- a/jgd-cmake-modules/JcmStandardDirs.cmake +++ b/jgd-cmake-modules/JcmStandardDirs.cmake @@ -3,6 +3,8 @@ JcmStandardDirs --------------- +:github:`JcmStandardDirs` + Provies variables defining standard project directories for the source, build, and install trees. All installation paths are versioned such that multiple versions of the same project can be installed in the same location. diff --git a/jgd-cmake-modules/JcmSymlinks.cmake b/jgd-cmake-modules/JcmSymlinks.cmake index 9be26cd..734570c 100644 --- a/jgd-cmake-modules/JcmSymlinks.cmake +++ b/jgd-cmake-modules/JcmSymlinks.cmake @@ -5,6 +5,8 @@ include_guard() JcmSymlinks ----------- +:github:`JcmSymlinks` + Provides functions for working with symbolic links, including those to inspect their availability and to trace a symbolic link chain. diff --git a/jgd-cmake-modules/JcmTargetNaming.cmake b/jgd-cmake-modules/JcmTargetNaming.cmake index 9b4888b..f0c3749 100644 --- a/jgd-cmake-modules/JcmTargetNaming.cmake +++ b/jgd-cmake-modules/JcmTargetNaming.cmake @@ -5,6 +5,8 @@ include_guard() JcmTargetNaming --------------- +:github:`JcmTargetNaming` + #]=======================================================================] include(JcmParseArguments) diff --git a/jgd-cmake-modules/JcmTargetSources.cmake b/jgd-cmake-modules/JcmTargetSources.cmake index 9f2742d..1441c16 100644 --- a/jgd-cmake-modules/JcmTargetSources.cmake +++ b/jgd-cmake-modules/JcmTargetSources.cmake @@ -5,6 +5,8 @@ include_guard() JcmTargetSources ---------------- +:github:`JcmTargetSources` + #]=======================================================================] include(JcmParseArguments) diff --git a/jgd-cmake-modules/find-modules/FindClangFormat.cmake b/jgd-cmake-modules/find-modules/FindClangFormat.cmake index 7399d4f..2eafade 100644 --- a/jgd-cmake-modules/find-modules/FindClangFormat.cmake +++ b/jgd-cmake-modules/find-modules/FindClangFormat.cmake @@ -1,7 +1,9 @@ #[=======================================================================[.rst: FindClangFormat -------------------- +--------------- + +:github:`find-modules/FindClangFormat` A CMake `find module `_ used to find the diff --git a/jgd-cmake-modules/find-modules/FindSphinx.cmake b/jgd-cmake-modules/find-modules/FindSphinx.cmake index 87a88e9..79c93d3 100644 --- a/jgd-cmake-modules/find-modules/FindSphinx.cmake +++ b/jgd-cmake-modules/find-modules/FindSphinx.cmake @@ -1,6 +1,9 @@ #[=======================================================================[.rst: + FindSphinx -------------------- +---------- + +:github:`find-modules/FindSphinx` A CMake `find module `_ used to find the