set the GLM_INCLUDE_DIRS var in cache so find hits it

This commit is contained in:
Stephen Birarda 2015-02-13 14:50:12 -08:00
parent 8c998a65ee
commit 6e63c1c1ad
4 changed files with 13 additions and 10 deletions

View file

@ -1,11 +1,15 @@
set(EXTERNAL_NAME glm)
include(ExternalProject)
ExternalProject_Add(
glm
PREFIX glm
${EXTERNAL_NAME}
PREFIX ${EXTERNAL_NAME}
URL https://github.com/g-truc/glm/archive/0.9.5.4.zip
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
LOG_DOWNLOAD ON
)
ExternalProject_Get_Property(glm install_dir)
export(TARGETS glm FILE ${CMAKE_BINARY_DIR}/glm-config.cmake)
ExternalProject_Get_Property(${EXTERNAL_NAME} install_dir)
string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER)
set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${install_dir}/include CACHE TYPE STRING)

View file

@ -21,8 +21,5 @@ macro(ADD_DEPENDENCY_EXTERNAL_PROJECT _PROJ_NAME)
add_subdirectory(${EXTERNAL_PROJECT_DIR}/${_PROJ_NAME} ${_PROJ_BINARY_DIR})
endif ()
string(TOUPPER ${_PROJ_NAME} _PROJ_NAME_UPPER)
get_target_property(${_PROJ_NAME_UPPER}_INCLUDE_DIRS ${_PROJ_NAME} INCLUDE_DIRS)
add_dependencies(${TARGET_NAME} ${_PROJ_NAME})
endmacro()

View file

@ -18,9 +18,7 @@ include("${MACRO_DIR}/HifiLibrarySearchHints.cmake")
hifi_library_search_hints("glm")
# locate header
find_path(GLM_INCLUDE_DIR "glm/glm.hpp" HINTS ${GLM_SEARCH_DIRS})
set(GLM_INCLUDE_DIRS "${GLM_INCLUDE_DIR}")
find_path(GLM_INCLUDE_DIRS "glm/glm.hpp" HINTS ${GLM_SEARCH_DIRS})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GLM DEFAULT_MSG GLM_INCLUDE_DIRS)

View file

@ -4,5 +4,9 @@ set(TARGET_NAME shared)
# TODO: there isn't really a good reason to have Script linked here - let's get what is requiring it out (RegisteredMetaTypes.cpp)
setup_hifi_library(Gui Network Script Widgets)
add_dependency_external_project(glm)
find_package(GLM REQUIRED)
target_include_directories(${TARGET_NAME} PRIVATE ${GLM_INCLUDE_DIRS})
# call macro to include our dependency includes and bubble them up via a property on our target
include_dependency_includes()