diff options
author | Brad King <brad.king@kitware.com> | 2018-09-26 14:06:15 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-09-26 14:06:21 (GMT) |
commit | c8137850445d180bd5f3b55d4f9e80d9cbcf0baa (patch) | |
tree | 3a713faf096be1d95928ec28ad75d6a97bc40621 /Modules | |
parent | 5f702f97a89129a39bcf1ecf9823d60a2793e35e (diff) | |
parent | 0da645d4523474093f36d66722dfcd3aa008a40d (diff) | |
download | CMake-c8137850445d180bd5f3b55d4f9e80d9cbcf0baa.zip CMake-c8137850445d180bd5f3b55d4f9e80d9cbcf0baa.tar.gz CMake-c8137850445d180bd5f3b55d4f9e80d9cbcf0baa.tar.bz2 |
Merge topic 'FindGLUT-windows-debug'
0da645d452 FindGLUT: Find debug/release variants on Windows
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2398
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindGLUT.cmake | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake index 88d4b29..1779683 100644 --- a/Modules/FindGLUT.cmake +++ b/Modules/FindGLUT.cmake @@ -34,20 +34,30 @@ # GLUT_Xmu_LIBRARY = the full path to the Xmu library. # GLUT_Xi_LIBRARY = the full path to the Xi Library. +include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + if (WIN32) find_path( GLUT_INCLUDE_DIR NAMES GL/glut.h PATHS ${GLUT_ROOT_PATH}/include ) - find_library( GLUT_glut_LIBRARY NAMES glut glut32 freeglut + find_library( GLUT_glut_LIBRARY_RELEASE NAMES glut glut32 freeglut PATHS ${OPENGL_LIBRARY_DIR} ${GLUT_ROOT_PATH}/Release ) + find_library( GLUT_glut_LIBRARY_DEBUG NAMES freeglutd + PATHS + ${OPENGL_LIBRARY_DIR} + ${GLUT_ROOT_PATH}/Debug + ) + mark_as_advanced(GLUT_glut_LIBRARY_RELEASE GLUT_glut_LIBRARY_DEBUG) + select_library_configurations(GLUT_glut) else () if (APPLE) find_path(GLUT_INCLUDE_DIR glut.h ${OPENGL_LIBRARY_DIR}) find_library(GLUT_glut_LIBRARY GLUT DOC "GLUT library for OSX") find_library(GLUT_cocoa_LIBRARY Cocoa DOC "Cocoa framework for OSX") + mark_as_advanced(GLUT_glut_LIBRARY GLUT_cocoa_LIBRARY) if(GLUT_cocoa_LIBRARY AND NOT TARGET GLUT::Cocoa) add_library(GLUT::Cocoa UNKNOWN IMPORTED) @@ -72,10 +82,12 @@ else () find_library( GLUT_Xi_LIBRARY Xi /usr/openwin/lib ) + mark_as_advanced(GLUT_Xi_LIBRARY) find_library( GLUT_Xmu_LIBRARY Xmu /usr/openwin/lib ) + mark_as_advanced(GLUT_Xmu_LIBRARY) if(GLUT_Xi_LIBRARY AND NOT TARGET GLUT::Xi) add_library(GLUT::Xi UNKNOWN IMPORTED) @@ -104,6 +116,7 @@ else () /usr/openwin/lib ${_GLUT_glut_LIB_DIR} ) + mark_as_advanced(GLUT_glut_LIBRARY) unset(_GLUT_INC_DIR) unset(_GLUT_glut_LIB_DIR) @@ -135,8 +148,24 @@ if (GLUT_FOUND) set_target_properties(GLUT::GLUT PROPERTIES IMPORTED_LOCATION "${GLUT_glut_LIBRARY}/${CMAKE_MATCH_1}") else() - set_target_properties(GLUT::GLUT PROPERTIES - IMPORTED_LOCATION "${GLUT_glut_LIBRARY}") + if(GLUT_glut_LIBRARY_RELEASE) + set_property(TARGET GLUT::GLUT APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(GLUT::GLUT PROPERTIES + IMPORTED_LOCATION_RELEASE "${GLUT_glut_LIBRARY_RELEASE}") + endif() + + if(GLUT_glut_LIBRARY_DEBUG) + set_property(TARGET GLUT::GLUT APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(GLUT::GLUT PROPERTIES + IMPORTED_LOCATION_DEBUG "${GLUT_glut_LIBRARY_DEBUG}") + endif() + + if(NOT GLUT_glut_LIBRARY_RELEASE AND NOT GLUT_glut_LIBRARY_DEBUG) + set_property(TARGET GLUT::GLUT APPEND PROPERTY + IMPORTED_LOCATION "${GLUT_glut_LIBRARY}") + endif() endif() if(TARGET GLUT::Xmu) @@ -160,9 +189,4 @@ if (GLUT_FOUND) set (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR}) endif() -mark_as_advanced( - GLUT_INCLUDE_DIR - GLUT_glut_LIBRARY - GLUT_Xmu_LIBRARY - GLUT_Xi_LIBRARY - ) +mark_as_advanced(GLUT_INCLUDE_DIR) |