Skip to content

Commit

Permalink
FindGFLW3: Fix #133
Browse files Browse the repository at this point in the history
  • Loading branch information
traversaro committed Sep 11, 2018
1 parent 3b628e2 commit b169aa4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
32 changes: 20 additions & 12 deletions find-modules/FindGLFW3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,26 @@ if(NOT GLFW3_FOUND)
endif()


# Create imported target GLFW::glfw3
add_library(GLFW3::GLFW3 STATIC IMPORTED)
set_target_properties(GLFW3::GLFW3 PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${GLFW3_INCLUDE_DIR}")
# Create imported target GLFW::GLFW3
if(TARGET glfw)
# If the upstream target glfw exists, make GLFW::GLFW3 an alias of it
# Note: ALIAS of imported targets are not supported, so we define an
# imported interface target that links in a public way to glfw
add_library(GLFW3::GLFW3 INTERFACE IMPORTED)
set_target_properties(GLFW3::GLFW3 PROPERTIES INTERFACE_LINK_LIBRARIES glfw)
else()
add_library(GLFW3::GLFW3 STATIC IMPORTED)
set_target_properties(GLFW3::GLFW3 PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${GLFW3_INCLUDE_DIR}")

if(WIN32)
if(WIN32)
set_target_properties(GLFW3::GLFW3 PROPERTIES
INTERFACE_LINK_LIBRARIES "${GLFW3_OPENGL_LIBRARY}")
endif()

# Import target "GLFW3::GLFW3" for configuration "Release"
set_property(TARGET GLFW3::GLFW3 APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(GLFW3::GLFW3 PROPERTIES
INTERFACE_LINK_LIBRARIES "${GLFW3_OPENGL_LIBRARY}")
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
IMPORTED_LOCATION_RELEASE "${GLFW3_GLFW_LIBRARY}")
endif()

# Import target "GLFW3::GLFW3" for configuration "Release"
set_property(TARGET GLFW3::GLFW3 APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(GLFW3::GLFW3 PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
IMPORTED_LOCATION_RELEASE "${GLFW3_GLFW_LIBRARY}")
7 changes: 7 additions & 0 deletions help/release/0.9.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ Generic Modules

* :module:`FindOrBuildPackage`: Fixed a typo that made ``find_or_build_package``
dismiss the first argument passed after the requested package name.

Find Modules
------------

* The :module:`FindGLFW3` is now using the ``glfw`` target exported from upstream
if available.

0 comments on commit b169aa4

Please sign in to comment.