SelectLibraryConfigurations_SLIC3R.cmake 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. # Modified from the CMake github master.
  2. # required by the bundled FindCURL.cmake
  3. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  4. # file Copyright.txt or https://cmake.org/licensing for details.
  5. #.rst:
  6. # SelectLibraryConfigurations
  7. # ---------------------------
  8. #
  9. #
  10. #
  11. # select_library_configurations( basename )
  12. #
  13. # This macro takes a library base name as an argument, and will choose
  14. # good values for basename_LIBRARY, basename_LIBRARIES,
  15. # basename_LIBRARY_DEBUG, and basename_LIBRARY_RELEASE depending on what
  16. # has been found and set. If only basename_LIBRARY_RELEASE is defined,
  17. # basename_LIBRARY will be set to the release value, and
  18. # basename_LIBRARY_DEBUG will be set to basename_LIBRARY_DEBUG-NOTFOUND.
  19. # If only basename_LIBRARY_DEBUG is defined, then basename_LIBRARY will
  20. # take the debug value, and basename_LIBRARY_RELEASE will be set to
  21. # basename_LIBRARY_RELEASE-NOTFOUND.
  22. #
  23. # If the generator supports configuration types, then basename_LIBRARY
  24. # and basename_LIBRARIES will be set with debug and optimized flags
  25. # specifying the library to be used for the given configuration. If no
  26. # build type has been set or the generator in use does not support
  27. # configuration types, then basename_LIBRARY and basename_LIBRARIES will
  28. # take only the release value, or the debug value if the release one is
  29. # not set.
  30. # This macro was adapted from the FindQt4 CMake module and is maintained by Will
  31. # Dicharry <wdicharry@stellarscience.com>.
  32. macro( select_library_configurations_SLIC3R basename )
  33. if(NOT ${basename}_LIBRARY_RELEASE)
  34. set(${basename}_LIBRARY_RELEASE "${basename}_LIBRARY_RELEASE-NOTFOUND" CACHE FILEPATH "Path to a library.")
  35. endif()
  36. if(NOT ${basename}_LIBRARY_DEBUG)
  37. set(${basename}_LIBRARY_DEBUG "${basename}_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "Path to a library.")
  38. endif()
  39. get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
  40. if( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND
  41. NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE AND
  42. ( _isMultiConfig OR CMAKE_BUILD_TYPE ) )
  43. # if the generator is multi-config or if CMAKE_BUILD_TYPE is set for
  44. # single-config generators, set optimized and debug libraries
  45. set( ${basename}_LIBRARY "" )
  46. foreach( _libname IN LISTS ${basename}_LIBRARY_RELEASE )
  47. list( APPEND ${basename}_LIBRARY optimized "${_libname}" )
  48. endforeach()
  49. foreach( _libname IN LISTS ${basename}_LIBRARY_DEBUG )
  50. list( APPEND ${basename}_LIBRARY debug "${_libname}" )
  51. endforeach()
  52. elseif( ${basename}_LIBRARY_RELEASE )
  53. set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} )
  54. elseif( ${basename}_LIBRARY_DEBUG )
  55. set( ${basename}_LIBRARY ${${basename}_LIBRARY_DEBUG} )
  56. else()
  57. set( ${basename}_LIBRARY "${basename}_LIBRARY-NOTFOUND")
  58. endif()
  59. set( ${basename}_LIBRARIES "${${basename}_LIBRARY}" )
  60. if( ${basename}_LIBRARY )
  61. set( ${basename}_FOUND TRUE )
  62. endif()
  63. mark_as_advanced( ${basename}_LIBRARY_RELEASE
  64. ${basename}_LIBRARY_DEBUG
  65. )
  66. endmacro()