glew icon indicating copy to clipboard operation
glew copied to clipboard

cmake/Windows/mingw: TARGET_PDB_FILE is not supported by the target linker

Open ghost opened this issue 7 years ago • 4 comments

Hello Guys , I am trying to build glew for windows with MinGW32 compiller. I use cmake to create the makefile, but it return me the following error :

CMake Error:
Error evaluating generator expression:
     $<TARGET_PDB_FILE:glew>
     TARGET_PDB_FILE is not supported by the target linker.

I have try with those ones : https://sourceforge.net/projects/glew/files/glew/snapshots/glew-20160708.tgz/download https://sourceforge.net/projects/glew/files/glew/2.0.0/glew-2.0.0.zip/download But i get the same error. Do you guys have any idea on what i am doing wrong ?

I am trying to build glew because i'm afraid that the official win32 release which include .lib will not work with MinGW ?

Thanks for your time Cheers

ghost avatar Mar 28 '17 08:03 ghost

Same issue for me. I was able to fix it by changing the line 194 in the file build/cmake/CMakeLists.txt to: if(WIN32 AND MSVC AND (NOT MSVC_VERSION LESS 1600) AND (NOT CMAKE_VERSION VERSION_LESS "3.1")) (Note the extra AND MSVC) However, it would be great to have a release with this fixed for non MSVC generators.

MateusMP avatar Mar 30 '17 22:03 MateusMP

Thanks a lot for your Help MateusMP ! It does solve the problem , i wouldn't have figure that by myself ...

ghost avatar Mar 31 '17 07:03 ghost

Thanks for that. It's about time for a GLEW release, I'll see if I can put more of the cmake scenarios in the test plan.

nigels-com avatar Apr 02 '17 22:04 nigels-com

I suppose that the TARGET_PDB_FILE generator expressions wasn't supposed to work for STATIC builds on MSVC either. According to this issue: TARGET_PDB_FILE does not work on MSVC static libraries and the documentation: PDB_NAME the property does not apply to STATIC libraries and should not be used if BUILD_SHARED is OFF.

I would suggest changing it to to:

if(WIN32 AND MSVC AND (NOT MSVC_VERSION LESS 1600))
    install(
        FILES $<$<BOOL:${BUILD_SHARED_LIBS}>:$<TARGET_PDB_FILE:glew>>
        DESTINATION ${CMAKE_INSTALL_LIBDIR}
        CONFIGURATIONS Debug RelWithDebInfo
    )
endif()

And change:

cmake_minimum_required (VERSION 3.0)

to

cmake_minimum_required (VERSION 3.1)

Since the TARGET_PDB_FILE was added in 3.1.

jpvanoosten avatar Jun 29 '22 18:06 jpvanoosten