Perlmint / glew-cmake

GLEW(https://github.com/nigels-com/glew, source updated nightly) with Cmake and pre-generated sources
Other
234 stars 95 forks source link

Use CMAKE_CURRENT_BINARY_DIR instead of CMAKE_BINARY_DIR #29

Closed Gpinchon closed 3 years ago

Gpinchon commented 4 years ago

Using CMAKE_SOURCE_DIR makes it so the library is built in the wrong directory when added to the project via FetchContent and then adding it using something like add_subdirectory(${glew_SOURCE_DIR} ${glew_BINARY_DIR})

Perlmint commented 4 years ago

First of all, Thanks for piling an issue. I'm sorry, But I can't find a point using CMAKE_SOURCE_DIR - only used in here - possibly occurring error on the master branch. Can you specify the actual point?

Gpinchon commented 4 years ago

Sorry, I meant CMAKE_CURRENT_BINARY_DIR instead of CMAKE_BINARY_DIR. But after investigating, I think it's even better to avoid setting CMAKE_ARCHIVE_OUTPUT_DIRECTORY, CMAKE_LIBRARY_OUTPUT_DIRECTORY and CMAKE_RUNTIME_OUTPUT_DIRECTORY altogether, as it keeps parent projects from choosing where to put glew's files. And by default, dll and lib files are put in build/bin and build/lib anyway.

[EDIT] After testing I can confirm that by removing the CMake output setting from CMakeLists.txt, the files are correctly placed by default (ie : the dll next to my .exe, and the lib in /lib)

Gpinchon commented 4 years ago

I did a fork, do you want me to do a PR ?

Perlmint commented 4 years ago

If you can make a PR, I will appreciate it.