Closed halehOssadat closed 2 years ago
GLM can be found in distro repositories. I don't think your suggested solution is the best way to go.
I'm actually having trouble compiling because of that. Took me a while to notice that while I had GLM installed, the target glm::glm was not found and that that was to be expected. @halehOssadat can you please share what you did?
I ended up adding this to CMakeLists.txt I found on this repository which also uses GLM and it worked then:
FIND_PACKAGE(glm QUIET)
IF(glm_FOUND)
IF(TARGET glm::glm)
MESSAGE(STATUS "Found glm")
ELSE()
# fallback for old glm version in EmuELEC and Nix
GET_TARGET_PROPERTY(GLM_INCLUDE_DIR glm INTERFACE_INCLUDE_DIRECTORIES)
MESSAGE(STATUS "Found glm: ${GLM_INCLUDE_DIR}")
ADD_LIBRARY(glm::glm INTERFACE IMPORTED)
SET_TARGET_PROPERTIES(glm::glm PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${GLM_INCLUDE_DIR})
ENDIF()
ELSE()
# fallback for old glm version in UBPorts
FIND_PATH(GLM_INCLUDE_DIR
NAMES glm/glm.hpp
PATHS ${GLM_ROOT_DIR}/include)
IF(NOT GLM_INCLUDE_DIR)
MESSAGE(FATAL_ERROR "glm library missing")
ENDIF()
MESSAGE(STATUS "Found glm: ${GLM_INCLUDE_DIR}")
ADD_LIBRARY(glm::glm INTERFACE IMPORTED)
SET_TARGET_PROPERTIES(glm::glm PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${GLM_INCLUDE_DIR})
ENDIF()
Thank you for commenting.
What distro are you running? It seems to work fine on the build system that Github uses...
GLM is mostly headers and it doens't have a library to be linked so there is no need to include it in TARGET_LINK_LIBRARIES and because Cmake can not find it, it is better that its include directory be set by the user the same as trimesh2.