Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle the no-target case through user information. #408

Merged
merged 1 commit into from
Jun 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ IF(COMMAND ADD_REQUIRED_DEPENDENCY)
ENDFOREACH()
ENDIF(COMMAND ADD_REQUIRED_DEPENDENCY)

include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
@INCLUDE_TARGETS_FILE@

foreach(component ${@PROJECT_NAME@_FIND_COMPONENTS})
set(comp_file "${CMAKE_CURRENT_LIST_DIR}/${component}Config.cmake")
Expand Down
7 changes: 7 additions & 0 deletions base.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@
# This tells jrl-cmakemodules that you are using export functionalities so it will
# hook the installation of your configuration files. Defaults to false
#
# .. variable:: PROJECT_EXPORT_NO_TARGET
#
# This tells jrl-cmakemodules that there is no targets in the project.
# However the export functionalities are still provided to detect the
# project properties. Not setting this variable when no target is present
# will result in an error.
#
# Macros
# ------
#
Expand Down
14 changes: 12 additions & 2 deletions package-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ if(_PKG_CONFIG_REQUIRES)
endforeach()
list(REMOVE_DUPLICATES _PKG_CONFIG_REQUIRES_LIST)
endif(_PKG_CONFIG_REQUIRES)

if(NOT PROJECT_EXPORT_NO_TARGET)
set(INCLUDE_TARGETS_FILE "include(\"\${CMAKE_CURRENT_LIST_DIR}/${TARGETS_EXPORT_NAME}.cmake\")")
else()
set(INCLUDE_TARGETS_FILE "# Package with no targets")
endif()

configure_package_config_file(
"cmake/Config.cmake.in"
"${PROJECT_CONFIG}"
Expand All @@ -170,11 +177,14 @@ install(

# Config
# * <prefix>/lib/cmake/Foo/FooTargets.cmake
install(
if(NOT PROJECT_EXPORT_NO_TARGET)
install(
EXPORT "${TARGETS_EXPORT_NAME}"
NAMESPACE "${namespace}"
DESTINATION "${CONFIG_INSTALL_DIR}"
)
)
endif()

ENDMACRO(SETUP_PROJECT_PACKAGE_FINALIZE)

#.rst:
Expand Down