Closed nim65s closed 4 months ago
Hi,
This adds a CMakeLists.txt to this project, to allow its installation, and therefore provide an alternative distribution strategy.
CMakeLists.txt
With this, one can install the jrl-cmakemodules, and after that use it in another project with:
find_package(jrl-cmakemodules REQUIRED CONFIG) get_property( JRL_CMAKE_MODULES TARGET jrl-cmakemodules::jrl-cmakemodules PROPERTY INTERFACE_INCLUDE_DIRECTORIES) include("${JRL_CMAKE_MODULES}/base.cmake") # as usual
That strategy allows to have only one copy of the jrl-cmakemodules on a setup with potentially dozens of packages using it.
This keeps compatibility with previous distributions methods, so to either (in order):
cmake
FetchContent
one can:
set(JRL_CMAKE_MODULES "${CMAKE_CURRENT_LIST_DIR}/cmake") if(EXISTS "${JRL_CMAKE_MODULES}/base.cmake") message(STATUS "JRL cmakemodules found in 'cmake/' git submodule") else() find_package(jrl-cmakemodules QUIET CONFIG) if(jrl-cmakemodules_FOUND) get_property( JRL_CMAKE_MODULES TARGET jrl-cmakemodules::jrl-cmakemodules PROPERTY INTERFACE_INCLUDE_DIRECTORIES) message(STATUS "JRL cmakemodules found on system at ${JRL_CMAKE_MODULES}") elseif(${CMAKE_VERSION} VERSION_LESS "3.14.0") message( FATAL_ERROR "\nCan't find jrl-cmakemodules. Please either:\n" " - use git submodule: 'git submodule update --init'\n" " - or install https://github.com/jrl-umi3218/jrl-cmakemodules\n" " - or upgrade your CMake version to >= 3.14\n") else() message(STATUS "JRL cmakemodules not found. Let's fetch it.") include(FetchContent) FetchContent_Declare( "jrl-cmakemodules" GIT_REPOSITORY "https://github.com/jrl-umi3218/jrl-cmakemodules.git") FetchContent_MakeAvailable("jrl-cmakemodules") FetchContent_GetProperties("jrl-cmakemodules" SOURCE_DIR JRL_CMAKE_MODULES) endif() endif()
With this, we might want to start versioning this project.
Hi,
This adds a
CMakeLists.txt
to this project, to allow its installation, and therefore provide an alternative distribution strategy.With this, one can install the jrl-cmakemodules, and after that use it in another project with:
That strategy allows to have only one copy of the jrl-cmakemodules on a setup with potentially dozens of packages using it.
This keeps compatibility with previous distributions methods, so to either (in order):
cmake
git submoduleFetchContent
and download latest version from githubone can:
With this, we might want to start versioning this project.