Skip to content

Commit

Permalink
emit warning w/o licenses
Browse files Browse the repository at this point in the history
  • Loading branch information
justend29 committed Mar 12, 2024
1 parent 2182395 commit 2523ff9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.24)
project(
jgd-cmake-modules
VERSION 3.3.0
VERSION 3.4.0
DESCRIPTION "CMake library for standardized CMake projects for JGD"
HOMEPAGE_URL "https://jgd-solutions.github.io/jgd-cmake-modules/"
LANGUAGES NONE)
Expand Down
20 changes: 16 additions & 4 deletions jgd-cmake-modules/JcmInstallConfigFilePackage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ Options
:cmake:command:`jcm_configure_package_config_file`
:cmake:variable:`INSTALL_LICENSES`
Causes this function to install licenses from the paths described above.
Causes this function to install licenses from the paths described above. Should there be no
licenses in these paths, an author warning will be emitted and installation of other files
will continue without hindrance.
Multi Value
~~~~~~~~~~~
Expand Down Expand Up @@ -315,9 +317,10 @@ function(jcm_install_config_file_package)

# == Install project licenses ==

function(install_licenses license_glob dest_suffix)
function(install_licenses license_glob dest_suffix out_found)
file(GLOB license_files LIST_DIRECTORIES false "${license_glob}")
if(NOT license_files)
set(${out_found} FALSE PARENT_SCOPE)
return()
endif()

Expand All @@ -338,11 +341,20 @@ function(jcm_install_config_file_package)
"to a non-existent path: ${target_file}")
endif()
endforeach()

set(${out_found} TRUE PARENT_SCOPE)
endfunction()

if(ARGS_INSTALL_LICENSES)
cmake_path(GET JCM_PROJECT_LICENSES_DIR FILENAME licenses_dir)
install_licenses("${PROJECT_SOURCE_DIR}/LICENSE*" "")
install_licenses("${JCM_PROJECT_LICENSES_DIR}/*" "${licenses_dir}")
set(found_root_license FALSE)
set(found_dir_licenses FALSE)
install_licenses("${PROJECT_SOURCE_DIR}/LICENSE*" "" found_root_license)
install_licenses("${JCM_PROJECT_LICENSES_DIR}/*" "${licenses_dir}" found_dir_licenses)
if(NOT (found_root_license OR found_root_license))
message(AUTHOR_WARNING
"INSTALL_LICENSES was specified to ${CMAKE_CURRENT_FUNCTION} but no licenses were found "
"in the project's source tree.")
endif()
endif()
endfunction()
2 changes: 1 addition & 1 deletion vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jgd-cmake-modules",
"version": "3.3.0",
"version": "3.4.0",
"description": "CMake library for standardized CMake projects for JGD",
"homepage": "https://jgd-solutions.github.io/jgd-cmake-modules/",
"dependencies": []
Expand Down

0 comments on commit 2523ff9

Please sign in to comment.