From f9466c40f84ca1947ffa8a7d9190fcb043440ac4 Mon Sep 17 00:00:00 2001 From: Mischa Spiegelmock Date: Sat, 31 Oct 2015 21:54:34 -0700 Subject: [PATCH 1/3] stick OSX install in /usr/local prefix; 10.11 does not allow writing to /usr/{include,lib} --- config/Makefile.darwin | 1 + 1 file changed, 1 insertion(+) diff --git a/config/Makefile.darwin b/config/Makefile.darwin index 8dd6262..8daa371 100644 --- a/config/Makefile.darwin +++ b/config/Makefile.darwin @@ -1,3 +1,4 @@ +GLEW_DEST=/usr/local NAME = $(GLEW_NAME) CC = cc LD = cc From c8c0c1e480d2e236342345a6a93c1f20f8996531 Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Tue, 17 Nov 2015 21:23:51 +1000 Subject: [PATCH 2/3] OSX install to /usr/local as required by 10.11 El Capitan --- config/Makefile.darwin | 2 +- config/Makefile.darwin-ppc | 1 + config/Makefile.darwin-universal | 1 + config/Makefile.darwin-x86_64 | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/config/Makefile.darwin b/config/Makefile.darwin index 8daa371..93b2052 100644 --- a/config/Makefile.darwin +++ b/config/Makefile.darwin @@ -1,4 +1,4 @@ -GLEW_DEST=/usr/local +GLEW_DEST = /usr/local NAME = $(GLEW_NAME) CC = cc LD = cc diff --git a/config/Makefile.darwin-ppc b/config/Makefile.darwin-ppc index 60ae3fd..7dd99ff 100644 --- a/config/Makefile.darwin-ppc +++ b/config/Makefile.darwin-ppc @@ -1,3 +1,4 @@ +GLEW_DEST = /usr/local NAME = $(GLEW_NAME) CC = cc LD = cc diff --git a/config/Makefile.darwin-universal b/config/Makefile.darwin-universal index 2b3156b..dfd4eef 100644 --- a/config/Makefile.darwin-universal +++ b/config/Makefile.darwin-universal @@ -1,3 +1,4 @@ +GLEW_DEST = /usr/local NAME = $(GLEW_NAME) CC = cc LD = cc diff --git a/config/Makefile.darwin-x86_64 b/config/Makefile.darwin-x86_64 index 5e8156b..437bad4 100644 --- a/config/Makefile.darwin-x86_64 +++ b/config/Makefile.darwin-x86_64 @@ -1,3 +1,4 @@ +GLEW_DEST = /usr/local NAME = $(GLEW_NAME) CC = cc LD = cc From 66c5229ec2ece475704fa0fd162c0dae545842e9 Mon Sep 17 00:00:00 2001 From: Tamas Kenez Date: Tue, 10 Nov 2015 11:53:16 +0100 Subject: [PATCH 3/3] cmake: allow calling find_package(GLEW) multiple times --- build/cmake/glew-config.cmake | 20 +++++++++++++++++--- build/cmake/testbuild/CMakeLists.txt | 1 + 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/build/cmake/glew-config.cmake b/build/cmake/glew-config.cmake index 8d2907a..29efcbe 100644 --- a/build/cmake/glew-config.cmake +++ b/build/cmake/glew-config.cmake @@ -40,7 +40,21 @@ endif() foreach(_glew_target glew glewmx) set(_glew_src_target "GLEW::${_glew_target}${_glew_target_postfix}") string(TOUPPER "GLEW::${_glew_target}" _glew_dest_target) - add_library(${_glew_dest_target} ${_glew_target_type} IMPORTED) - # message(STATUS "add_library(${_glew_dest_target} ${_glew_target_type} IMPORTED)") - copy_imported_target_properties(${_glew_src_target} ${_glew_dest_target}) + if(TARGET ${_glew_dest_target}) + get_target_property(_glew_previous_src_target ${_glew_dest_target} + _GLEW_SRC_TARGET) + if(NOT _glew_previous_src_target STREQUAL _glew_src_target) + message(FATAL_ERROR "find_package(GLEW) was called the second time with " + "different GLEW_USE_STATIC_LIBS setting. Previously, " + "`glew-config.cmake` created ${_glew_dest_target} as a copy of " + "${_glew_previous_src_target}. Now it attempted to copy it from " + "${_glew_src_target}. ") + endif() + else() + add_library(${_glew_dest_target} ${_glew_target_type} IMPORTED) + # message(STATUS "add_library(${_glew_dest_target} ${_glew_target_type} IMPORTED)") + copy_imported_target_properties(${_glew_src_target} ${_glew_dest_target}) + set_target_properties(${_glew_dest_target} PROPERTIES + _GLEW_SRC_TARGET ${_glew_src_target}) + endif() endforeach() diff --git a/build/cmake/testbuild/CMakeLists.txt b/build/cmake/testbuild/CMakeLists.txt index 275e24d..27bcf2d 100644 --- a/build/cmake/testbuild/CMakeLists.txt +++ b/build/cmake/testbuild/CMakeLists.txt @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 2.8.12) project(glew-cmake-test) find_package(GLEW REQUIRED CONFIG) +find_package(GLEW REQUIRED CONFIG) # call twice to test multiple call find_package(OpenGL REQUIRED) add_executable(cmake-test main.c)