Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update FindGLFW3.cmake to support the latest version installed from vcpkg #133

Closed
traversaro opened this issue May 5, 2018 · 8 comments
Closed
Assignees

Comments

@traversaro
Copy link
Member

In https://github.com/robotology/yarp/issues/1675 , @mebbaid observed problem with the FindGLFW3.cmake script shipped with YCM when used with the latest glfw3 installed by vcpkg. We should check if it needs to be updated.

@mebbaid can you provide the details of your modification to the FindGLFW3.cmake file? Thanks

@traversaro
Copy link
Member Author

By the way, as the latest glfw3 install its own glfw3Config.cmake file that exposes the glfw imported target. it could make sense to add in the FindGLFW3.cmake a call to find_package(glfw3 CONFIG) and, if the glfw imported target is defined, define GLFW3_INCLUDE_DIRS, GLFW3_LIBRARIES and GLFW3::GLFW3 from the data in the glfw imported target.
Unfortunately just drop the FindGLFW3.cmake script until we support Ubuntu 16.04, as in this system glfw3Config.cmake does not define the glfw imported target.

cc @drdanz @claudiofantacci

@traversaro traversaro changed the title Update FindGLFW3.cmake to support the latest Update FindGLFW3.cmake to support the latest version installed from vcpkg May 5, 2018
traversaro referenced this issue in robotology/superimpose-mesh-lib May 5, 2018
@mebbaid
Copy link

mebbaid commented May 5, 2018

error
@traversaro : yeah, the thing is, when you install the package using vcpkg install --triplet x64-windows glfw3 , this part of FindGLFW3.cmake:

if(NOT GLFW3_FOUND)
  find_path(GLFW3_INCLUDE_DIR
            DOC "Path to GLFW3 include directory."
            NAMES GLFW/glfw3.h
            PATH_SUFFIXES include
            PATHS /usr/
                  /usr/local/
                  ${GLFW3_ROOT_DIR}
                  ENV GLFW3_ROOT)
find_library(GLFW3_GLFW_LIBRARY
              DOC "Absolute path to GLFW3 library."
              NAMES glfw3
                    glfw3dll
              PATH_SUFFIXES lib
                            lib-vc2010
              PATHS /usr/
                    /usr/local/
                    ${GLFW3_ROOT_DIR}
                    ENV GLFW3_ROOT)
....

is not executed, since GLFW FOUND TRUE because it is there in the standard CMAKE_PREFIX_PATH. however this means the linker will not be able to open this GLFW3_GLFW_LIBRARY.obj thingy, which is supposed to point at glfw3dll.lib as far as i understand it. maybe more expert people can chime in, however what I did was to simply use if( GLFW3_FOUND) as well and then follow the same procedure for defining GLFW3_INCLUDE_DIRS and GLFW3_LIBRARIES.

@traversaro
Copy link
Member Author

I think #135 should fix this issue, by defining GLFW3::GLFW3 as an alias of glfw in case the imported target glfw is defined.

@drdanz
Copy link
Member

drdanz commented May 6, 2018

Is the glfw target coming from upstream or from vcpkg?

@traversaro
Copy link
Member Author

traversaro commented May 6, 2018

Upstream: https://github.com/glfw/glfw/blob/3.2.1/src/glfw3Config.cmake.in#L1 , it is just not there in the version of glfw packaged for Ubuntu 16.04 (otherwise we could directly drop the FindGFLW3 wrapper).

@drdanz
Copy link
Member

drdanz commented May 8, 2018

In this case we should make a patch to add the namespace to their target 😫

@randaz81
Copy link
Member

I have problems with glfw3 (clean installation).
Can you please tell me more abour the status of this issue? Can I use (and merge) #135?

@traversaro
Copy link
Member Author

For what concerns me, #135 is ready to be merged, but I did not tested it recently with vcpkg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants