Skip to content

Commit

Permalink
use custom role to link module sources to github
Browse files Browse the repository at this point in the history
  • Loading branch information
justend29 committed Mar 10, 2024
1 parent b01a091 commit ebb7f70
Show file tree
Hide file tree
Showing 23 changed files with 71 additions and 14 deletions.
2 changes: 2 additions & 0 deletions jgd-cmake-modules/JcmAddExecutable.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ include_guard()
JcmAddExecutable
----------------

:github:`JcmAddExecutable`

#]=======================================================================]

include(JcmParseArguments)
Expand Down
2 changes: 2 additions & 0 deletions jgd-cmake-modules/JcmAddLibrary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ include_guard()
JcmAddLibrary
-------------

:github:`JcmAddLibrary`

#]=======================================================================]

include(JcmParseArguments)
Expand Down
2 changes: 2 additions & 0 deletions jgd-cmake-modules/JcmAddOption.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ include_guard()
JcmAddOption
------------

:github:`JcmAddOption`

#]=======================================================================]

include(JcmParseArguments)
Expand Down
2 changes: 2 additions & 0 deletions jgd-cmake-modules/JcmAddTestExecutable.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ include_guard()
JcmAddTestExecutable
--------------------

:github:`JcmAddTestExecutable`

#]=======================================================================]

include(JcmParseArguments)
Expand Down
2 changes: 2 additions & 0 deletions jgd-cmake-modules/JcmAllModules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ include_guard()
JcmAllModules
-------------

:github:`JcmAllModules`

When included, includes all of JCM's CMake modules, excluding any `Find Modules
<https://cmake.org/cmake/help/latest/manual/cmake-developer.7.html#find-modules>`_.

Expand Down
2 changes: 2 additions & 0 deletions jgd-cmake-modules/JcmBasicPackageConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
JcmBasicPackageConfig
---------------------

:github:`JcmBasicPackageConfig`

Provides macros to create `Config-file Packages
<https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#config-file-packages>`_. Offers
the :cmake:command:`jcm_basic_package_config` macro for top-level config-files, and the
Expand Down
2 changes: 2 additions & 0 deletions jgd-cmake-modules/JcmCanonicalStructure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
19 changes: 14 additions & 5 deletions jgd-cmake-modules/JcmConfigureFiles.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ include_guard()
JcmConfigureFiles
-----------------

:github:`JcmConfigureFiles`

Use-case specific configure functions, like CMake's :cmake:command:`configure_file`
(`link <https://cmake.org/cmake/help/latest/command/configure_file.html>`_), but with features for
their respective use-case.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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}")

Expand Down Expand Up @@ -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()
Expand Down
2 changes: 2 additions & 0 deletions jgd-cmake-modules/JcmDefaultCompileOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions jgd-cmake-modules/JcmExpandDirectories.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ include_guard()
JcmExpandDirectories
--------------------

:github:`JcmExpandDirectories`

#]=======================================================================]

include(JcmParseArguments)
Expand All @@ -21,8 +23,7 @@ jcm_expand_directories
jcm_expand_directories(
OUT_VAR <out-var>
GLOB <glob>
PATHS <path>...
)
PATHS <path>...)


For each path in :cmake:variable:`PATHS`, if the path is a directory, the enclosed files matching
Expand Down
2 changes: 2 additions & 0 deletions jgd-cmake-modules/JcmFileNaming.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 2 additions & 0 deletions jgd-cmake-modules/JcmHeaderFileSet.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ include_guard()
JcmHeaderFileSet
----------------

:github:`JcmHeaderFileSet`

#]=======================================================================]

include(JcmParseArguments)
Expand Down
2 changes: 2 additions & 0 deletions jgd-cmake-modules/JcmInstallConfigFilePackage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ include_guard()
JcmInstallConfigFilePackage
---------------------------

:github:`JcmInstallConfigFilePackage`

#]=======================================================================]

include(JcmParseArguments)
Expand Down
2 changes: 2 additions & 0 deletions jgd-cmake-modules/JcmListTransformations.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ include(JcmTargetNaming)
JcmListTransformations
----------------------

:github:`JcmListTransformations`

#]=======================================================================]

#[=======================================================================[.rst:
Expand Down
2 changes: 2 additions & 0 deletions jgd-cmake-modules/JcmParseArguments.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ include_guard()
JcmParseArguments
-----------------

:github:`JcmParseArguments`

#]=======================================================================]

include(CMakeParseArguments)
Expand Down
2 changes: 2 additions & 0 deletions jgd-cmake-modules/JcmSetupProject.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
16 changes: 11 additions & 5 deletions jgd-cmake-modules/JcmSourceSubdirectories.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ include_guard()
JcmSourceSubdirectories
-----------------------

:github:`JcmSourceSubdirectories`

#]=======================================================================]

include(JcmParseArguments)
Expand Down Expand Up @@ -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: "
Expand All @@ -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})
Expand Down
2 changes: 2 additions & 0 deletions jgd-cmake-modules/JcmStandardDirs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions jgd-cmake-modules/JcmSymlinks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 2 additions & 0 deletions jgd-cmake-modules/JcmTargetNaming.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ include_guard()
JcmTargetNaming
---------------

:github:`JcmTargetNaming`

#]=======================================================================]

include(JcmParseArguments)
Expand Down
2 changes: 2 additions & 0 deletions jgd-cmake-modules/JcmTargetSources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ include_guard()
JcmTargetSources
----------------

:github:`JcmTargetSources`

#]=======================================================================]

include(JcmParseArguments)
Expand Down
4 changes: 3 additions & 1 deletion jgd-cmake-modules/find-modules/FindClangFormat.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#[=======================================================================[.rst:

FindClangFormat
-------------------
---------------

:github:`find-modules/FindClangFormat`

A CMake `find module
<https://cmake.org/cmake/help/latest/manual/cmake-developer.7.html#find-modules>`_ used to find the
Expand Down
5 changes: 4 additions & 1 deletion jgd-cmake-modules/find-modules/FindSphinx.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#[=======================================================================[.rst:

FindSphinx
-------------------
----------

:github:`find-modules/FindSphinx`

A CMake `find module
<https://cmake.org/cmake/help/latest/manual/cmake-developer.7.html#find-modules>`_ used to find the
Expand Down

0 comments on commit ebb7f70

Please sign in to comment.