From 168ad2a4b3bf4a6c81927df4821c180e10e9cd60 Mon Sep 17 00:00:00 2001 From: Nicholas Vitovitch Date: Tue, 10 Mar 2015 23:55:28 -0400 Subject: [PATCH] Export transitive dependencies Uses CMake 2.8.12 policy to export transitive interface libraries via glfw3Targets.cmake. This means we now link to dependent libraries (i.e. opengl32 on Win32) for free. --- CMakeLists.txt | 1 + src/CMakeLists.txt | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 41a962cdd..fc45be03e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ project(GLFW C) cmake_minimum_required(VERSION 2.8.12) +cmake_policy(SET CMP0022 NEW) if (NOT CMAKE_VERSION VERSION_LESS "3.0") # Until all major package systems have moved to CMake 3, diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 77a8501f6..91e6224ca 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -58,6 +58,7 @@ if (APPLE) endif() add_library(glfw ${glfw_SOURCES} ${glfw_HEADERS}) +target_link_libraries(glfw ${glfw_LIBRARIES}) set_target_properties(glfw PROPERTIES OUTPUT_NAME "${GLFW_LIB_NAME}" VERSION ${GLFW_VERSION} @@ -86,8 +87,6 @@ if (BUILD_SHARED_LIBS) COMPILE_FLAGS "${glfw_CFLAGS} -fno-common" INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}") endif() - - target_link_libraries(glfw ${glfw_LIBRARIES}) endif() if (GLFW_INSTALL)