Skip to content

Commit 6e63c1c

Browse files
committed
set the GLM_INCLUDE_DIRS var in cache so find hits it
1 parent 8c998a6 commit 6e63c1c

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

cmake/externals/glm/CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1+
set(EXTERNAL_NAME glm)
2+
13
include(ExternalProject)
24
ExternalProject_Add(
3-
glm
4-
PREFIX glm
5+
${EXTERNAL_NAME}
6+
PREFIX ${EXTERNAL_NAME}
57
URL https://github.com/g-truc/glm/archive/0.9.5.4.zip
68
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
79
LOG_DOWNLOAD ON
810
)
9-
ExternalProject_Get_Property(glm install_dir)
1011

11-
export(TARGETS glm FILE ${CMAKE_BINARY_DIR}/glm-config.cmake)
12+
ExternalProject_Get_Property(${EXTERNAL_NAME} install_dir)
13+
14+
string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER)
15+
set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${install_dir}/include CACHE TYPE STRING)

cmake/macros/AddDependencyExternalProject.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,5 @@ macro(ADD_DEPENDENCY_EXTERNAL_PROJECT _PROJ_NAME)
2121
add_subdirectory(${EXTERNAL_PROJECT_DIR}/${_PROJ_NAME} ${_PROJ_BINARY_DIR})
2222
endif ()
2323

24-
string(TOUPPER ${_PROJ_NAME} _PROJ_NAME_UPPER)
25-
get_target_property(${_PROJ_NAME_UPPER}_INCLUDE_DIRS ${_PROJ_NAME} INCLUDE_DIRS)
26-
2724
add_dependencies(${TARGET_NAME} ${_PROJ_NAME})
2825
endmacro()

cmake/modules/FindGLM.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ include("${MACRO_DIR}/HifiLibrarySearchHints.cmake")
1818
hifi_library_search_hints("glm")
1919

2020
# locate header
21-
find_path(GLM_INCLUDE_DIR "glm/glm.hpp" HINTS ${GLM_SEARCH_DIRS})
22-
23-
set(GLM_INCLUDE_DIRS "${GLM_INCLUDE_DIR}")
21+
find_path(GLM_INCLUDE_DIRS "glm/glm.hpp" HINTS ${GLM_SEARCH_DIRS})
2422

2523
include(FindPackageHandleStandardArgs)
2624
find_package_handle_standard_args(GLM DEFAULT_MSG GLM_INCLUDE_DIRS)

libraries/shared/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,9 @@ set(TARGET_NAME shared)
44
# TODO: there isn't really a good reason to have Script linked here - let's get what is requiring it out (RegisteredMetaTypes.cpp)
55
setup_hifi_library(Gui Network Script Widgets)
66

7+
add_dependency_external_project(glm)
8+
find_package(GLM REQUIRED)
9+
target_include_directories(${TARGET_NAME} PRIVATE ${GLM_INCLUDE_DIRS})
10+
711
# call macro to include our dependency includes and bubble them up via a property on our target
812
include_dependency_includes()

0 commit comments

Comments
 (0)