Skip to content
Snippets Groups Projects
Verified Commit e89d64ad authored by Lars Bilke's avatar Lars Bilke
Browse files

[cmake] Package license files of external dependencies.

parent 748e19bd
No related branches found
No related tags found
No related merge requests found
......@@ -75,5 +75,5 @@
fi
- |
if [[ "$CHECK_WARNINGS" = true ]] ; then
if [[ $(cat $log_file | grep warning -i | grep -v 'WARNING: no license files found') ]]; then printf 'There were compiler warnings:\n\n'; cat $log_file | grep warning -i | grep -v 'WARNING: no license files found'; exit 1; fi
if [[ $(cat $log_file | grep warning -i | grep -v 'WARNING: no license files found' | grep -v 'WARNING: multiple license files found') ]]; then printf 'There were compiler warnings:\n\n'; cat $log_file | grep warning -i | grep -v 'WARNING: no license files found' | grep -v 'WARNING: multiple license files found'; exit 1; fi
fi
......@@ -24,6 +24,13 @@ CPMAddPackage(
GIT_TAG ee49c4f973f66bb7bfd644658d14e43459f557fa
DOWNLOAD_ONLY YES
)
CPMAddPackage(
# TODO: VERSION 0.0.7 when
# https://github.com/cpm-cmake/CPMLicenses.cmake/pull/6 is merged
NAME CPMLicenses.cmake
GITHUB_REPOSITORY bilke/CPMLicenses.cmake
GIT_TAG 71b1512d81e6294a15aafd78df431ce2dd64a805
)
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
"${PROJECT_SOURCE_DIR}/scripts/cmake"
......
......@@ -402,12 +402,8 @@ if(CLANG_FORMAT_PROGRAM OR CMAKE_FORMAT_PROGRAM)
endif()
# Third-party licenses
CPMAddPackage(
NAME CPMLicenses.cmake GITHUB_REPOSITORY cpm-cmake/CPMLicenses.cmake
VERSION 0.0.5
)
cpm_licenses_create_disclaimer_target(
write-licenses "${PROJECT_BINARY_DIR}/third_party_licenses.txt"
write-licenses "${PROJECT_BINARY_DIR}/third_party_licenses_cpm.txt"
"${CPM_PACKAGES}"
)
......
......@@ -164,7 +164,9 @@ if(OGS_USE_PETSC)
target_include_directories(petsc INTERFACE ${PETSC_INCLUDES})
# Get first petsc lib as import location
list(GET PETSC_LIBRARIES 0 _first_petsc_lib)
set_target_properties(petsc PROPERTIES IMPORTED_LOCATION ${_first_petsc_lib})
set_target_properties(
petsc PROPERTIES IMPORTED_LOCATION ${_first_petsc_lib}
)
target_compile_definitions(petsc INTERFACE USE_PETSC)
endif()
......@@ -373,9 +375,17 @@ if(NOT VTK_FOUND)
BuildExternalProject_find_package(VTK)
endif()
# cmake-lint: disable=C0103
# append RPATHs
foreach(lib ${_EXT_LIBS})
set(CMAKE_BUILD_RPATH ${CMAKE_BUILD_RPATH} ${build_dir_${lib}}/lib
${build_dir_${lib}}/lib64
)
set(${lib}_SOURCE_DIR ${build_dir_${lib}}/src/${lib})
endforeach()
if(_EXT_LIBS)
write_license_disclaimer(
${PROJECT_BINARY_DIR}/third_party_licenses_ext.txt "${_EXT_LIBS}"
)
endif()
......@@ -96,4 +96,7 @@ install(FILES ${PROJECT_BINARY_DIR}/cmake_args TYPE INFO OPTIONAL)
install(
CODE "execute_process(COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR} --config ${CMAKE_BUILD_TYPE} -t write-licenses)"
)
install(FILES ${PROJECT_BINARY_DIR}/third_party_licenses.txt TYPE INFO)
install(FILES ${PROJECT_BINARY_DIR}/third_party_licenses_cpm.txt TYPE INFO)
if(EXISTS ${PROJECT_BINARY_DIR}/third_party_licenses_ext.txt)
install(FILES ${PROJECT_BINARY_DIR}/third_party_licenses_ext.txt TYPE INFO)
endif()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment