Skip to content

Commit

Permalink
Handle no-target case through a user information.
Browse files Browse the repository at this point in the history
Lean implementation.
  • Loading branch information
olivier-stasse committed Jun 18, 2020
1 parent 272d644 commit ec4a43a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
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
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_NAME}_ZERO_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_NAME}_ZERO_TARGET)
install(
EXPORT "${TARGETS_EXPORT_NAME}"
NAMESPACE "${namespace}"
DESTINATION "${CONFIG_INSTALL_DIR}"
)
)
endif()

ENDMACRO(SETUP_PROJECT_PACKAGE_FINALIZE)

#.rst:
Expand Down

0 comments on commit ec4a43a

Please sign in to comment.