Skip to content
Snippets Groups Projects
Commit 53027213 authored by Martin Christoph Hierholzer's avatar Martin Christoph Hierholzer
Browse files

fix ${@PROJECTNAME@_LIBRARIES} being unusable for header-only libraries

If a header-only library requires linking a 3rd party library, the ..._LIBRARIES variable could not be used in depending projects, because it
contained NOTFOUND.
parent 31052d65
No related branches found
No related tags found
No related merge requests found
......@@ -41,7 +41,11 @@ FIND_LIBRARY(@PROJECT_NAME@_LIBRARY @PROJECT_NAME@
set(@PROJECT_NAME@_VERSION "@@PROJECT_NAME@_SOVERSION@")
set(@PROJECT_NAME@_INCLUDE_DIRS @@PROJECT_NAME@_INCLUDE_DIRS@)
set(@PROJECT_NAME@_LIBRARY_DIRS @@PROJECT_NAME@_LIBRARY_DIRS@)
set(@PROJECT_NAME@_LIBRARIES ${@PROJECT_NAME@_LIBRARY} @@PROJECT_NAME@_LIBRARIES@)
if(@@PROJECT_NAME@_HAS_LIBRARY@)
set(@PROJECT_NAME@_LIBRARIES ${@PROJECT_NAME@_LIBRARY} @@PROJECT_NAME@_LIBRARIES@)
else()
set(@PROJECT_NAME@_LIBRARIES @@PROJECT_NAME@_LIBRARIES@)
endif()
set(@PROJECT_NAME@_CXX_FLAGS "@@PROJECT_NAME@_CXX_FLAGS@")
set(@PROJECT_NAME@_LINKER_FLAGS "@@PROJECT_NAME@_LINKER_FLAGS@ @@PROJECT_NAME@_LINK_FLAGS@")
set(@PROJECT_NAME@_LINK_FLAGS "@@PROJECT_NAME@_LINKER_FLAGS@ @@PROJECT_NAME@_LINK_FLAGS@")
......
......@@ -61,6 +61,12 @@ foreach(DEPENDENCY ${${PROJECT_NAME}_PUBLIC_DEPENDENCIES})
string(APPEND ${PROJECT_NAME}_PUBLIC_DEPENDENCIES_L "find_package(${DEPENDENCY} REQUIRED)\n")
endforeach()
if(TARGET ${PROJECT_NAME})
set(${PROJECT_NAME}_HAS_LIBRARY 1)
else()
set(${PROJECT_NAME}_HAS_LIBRARY 0)
endif()
# we have nested @-statements, so we have to parse twice:
# create the cmake find_package configuration file
......
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