← Back to team overview

kicad-developers team mailing list archive

Re: OSX glm include dir incorrect

 

Yet another patch (removes a CMake warning).  I missed one unmatched if()
endif() tag.  I opted to remove the tags in the endif() since the script is
short and easy enough to read.

- Cirilo

On Thu, Dec 10, 2015 at 7:42 AM, Cirilo Bernardo <cirilo.bernardo@xxxxxxxxx>
wrote:

> Here's an even better patch which incorporates Brano's check on the return
> value.
> I wasn't checking for "-NOTFOUND". Sorry about the earlier half-assed
> patch.
>
> On Thu, Dec 10, 2015 at 7:28 AM, Cirilo Bernardo <
> cirilo.bernardo@xxxxxxxxx> wrote:
>
>> My mistake - it was only concidence that the FindGLM script worked since
>> the
>> default search paths happened to have a glm/ directory.
>>
>> The attached patch should fix the problem.
>>
>> - Cirilo
>>
>>
>> On Thu, Dec 10, 2015 at 12:08 AM, Brano Panak <bpanak@xxxxxxxxx> wrote:
>>
>>> Hi,
>>> on OSX in CMakeLists.txt
>>> find_package( GLM 0.9.5.4 REQUIRED ) in my setup (osx + brew) returns
>>> incorrect path resulting in compiling error glm/glm.hpp not found. Include
>>> path found is: /usr/local/include/glm.
>>> Correct should be: /usr/local/include because of includes from sources
>>> are <glm/glm.hpp>
>>> workaround could be changes in source to include <glm.hpp> or change
>>> includes from cmake
>>>
>>> my workaround:
>>> # Find GLM library
>>> find_path(GLM_INCLUDE_DIR "glm/glm.hpp")
>>> if(GLM_INCLUDE_DIR STREQUAL "GLM_INCLUDE_DIR-NOTFOUND")
>>>     message(STATUS "glm not found")
>>> else()
>>>     message(STATUS "glm include dir: ${GLM_INCLUDE_DIR}")
>>>     include_directories("${GLM_INCLUDE_DIR}")
>>> endif()
>>>
>>> however this will not check glm version, could you please evaluate this
>>> workaround?
>>> regards
>>> Brano
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~kicad-developers
>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>
>>
>
=== modified file 'CMakeModules/FindGLM.cmake'
--- CMakeModules/FindGLM.cmake	2015-12-08 10:52:09 +0000
+++ CMakeModules/FindGLM.cmake	2015-12-09 22:12:27 +0000
@@ -8,15 +8,16 @@
 endif()
 
 
-find_path( GLM_INCLUDE_DIR glm.hpp PATH_SUFFIXES glm )
-
-
-if( NOT ${GLM_INCLUDE_DIR} STREQUAL "" )
+find_path( GLM_INCLUDE_DIR glm/glm.hpp )
+
+
+if( NOT ${GLM_INCLUDE_DIR} STREQUAL "GLM_INCLUDE_DIR-NOTFOUND" )
    
     # attempt to extract the GLM Version information from setup.hpp
-    find_file( GLM_SETUP setup.hpp PATHS ${GLM_INCLUDE_DIR} PATH_SUFFIXES core detail NO_DEFAULT_PATH )
+    find_file( GLM_SETUP setup.hpp PATHS ${GLM_INCLUDE_DIR} PATH_SUFFIXES glm/core glm/detail NO_DEFAULT_PATH )
 
-    if( GLM_SETUP )
+    if( NOT ${GLM_SETUP} STREQUAL "GLM_SETUP-NOTFOUND" )
+    
         # extract the "#define GLM_VERSION*" lines
         file( STRINGS ${GLM_SETUP} _version REGEX "^#define.*GLM_VERSION.*" )
         
@@ -50,14 +51,16 @@
         set( GLM_VERSION ${_GLM_VERSION_MAJOR}.${_GLM_VERSION_MINOR}.${_GLM_VERSION_PATCH}.${_GLM_VERSION_REVISION} )
         unset( GLM_SETUP CACHE )
         
-    endif( GLM_SETUP )
+    endif()
     
-endif( NOT ${GLM_INCLUDE_DIR} STREQUAL "" )
+endif()
 
 
 include( FindPackageHandleStandardArgs )
 FIND_PACKAGE_HANDLE_STANDARD_ARGS( GLM
-    REQUIRED_VARS GLM_INCLUDE_DIR
+    REQUIRED_VARS
+        GLM_INCLUDE_DIR
+        GLM_VERSION
     VERSION_VAR GLM_VERSION )
 
     


Follow ups

References