diff --git a/CMakeLists.txt b/CMakeLists.txt index cd12d3a9d..d0ec4cea9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -341,9 +341,24 @@ INCLUDE (FindPkgMacros) INCLUDE (PrecompiledHeader) # Set Assimp project output directory variables. -SET(ASSIMP_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" CACHE STRING "Path for runtime output files") -SET(ASSIMP_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" CACHE STRING "Path for library output files") -SET(ASSIMP_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib" CACHE STRING "Path for archive output files") +# Will respect top-level CMAKE_*_OUTPUT_DIRECTORY variables if any are set. +IF(NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY) + SET(ASSIMP_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" CACHE STRING "Path for runtime output files") +ELSE() + SET(ASSIMP_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} CACHE STRING "Path for runtime output files") +ENDIF() + +IF(NOT DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY) + SET(ASSIMP_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" CACHE STRING "Path for library output files") +ELSE() + SET(ASSIMP_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} CACHE STRING "Path for runtime output files") +ENDIF() + +IF(NOT DEFINED CMAKE_ARCHIVE_OUTPUT_DIRECTORY) + SET(ASSIMP_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib" CACHE STRING "Path for library output files") +ELSE() + SET(ASSIMP_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} CACHE STRING "Path for runtime output files") +ENDIF() # Macro used to set the output directories of a target to the # respective Assimp output directories.