Browse Source

CMake: Set each plugins output directory individually and per-config

pull/570/head
Hugo Amiard 4 years ago
parent
commit
04a64bc038
  1. 17
      src/MagnumPlugins/CMakeLists.txt

17
src/MagnumPlugins/CMakeLists.txt

@ -33,17 +33,20 @@ macro(add_plugin plugin_name plugin_folder debug_install_dirs release_install_di
corrade_add_static_plugin(${plugin_name} "${release_install_dirs}" ${metadata_file} ${ARGN}) corrade_add_static_plugin(${plugin_name} "${release_install_dirs}" ${metadata_file} ${ARGN})
set_target_properties(${plugin_name} ${plugin_name}-dependencies PROPERTIES FOLDER "MagnumPlugins/${plugin_name}") set_target_properties(${plugin_name} ${plugin_name}-dependencies PROPERTIES FOLDER "MagnumPlugins/${plugin_name}")
endif() endif()
# Modify only runtime output location if that one is set # For each type of output directory and each configuration, append the plugin subfolder only if the global CMAKE_ variable was set
if(CMAKE_RUNTIME_OUTPUT_DIRECTORY) foreach(output RUNTIME LIBRARY ARCHIVE)
if(CMAKE_${output}_OUTPUT_DIRECTORY)
set_target_properties(${plugin_name} PROPERTIES set_target_properties(${plugin_name} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/${plugin_folder}) ${output}_OUTPUT_DIRECTORY ${CMAKE_${output}_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/${plugin_folder})
endif() endif()
# Modify the other output locations if all are set # This doesn't handle custom build types as there's no way to know their names
if(CMAKE_RUNTIME_OUTPUT_DIRECTORY AND CMAKE_LIBRARY_OUTPUT_DIRECTORY AND CMAKE_ARCHIVE_OUTPUT_DIRECTORY) foreach(config DEBUG RELEASE RELWITHDEBINFO MINSIZEREL)
if(CMAKE_${output}_OUTPUT_DIRECTORY_${config})
set_target_properties(${plugin_name} PROPERTIES set_target_properties(${plugin_name} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/${plugin_folder} ${output}_OUTPUT_DIRECTORY_${config} ${CMAKE_${output}_OUTPUT_DIRECTORY_${config}}/magnum$<$<CONFIG:Debug>:-d>/${plugin_folder})
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/magnum$<$<CONFIG:Debug>:-d>/${plugin_folder})
endif() endif()
endforeach()
endforeach()
endmacro() endmacro()
if(MAGNUM_WITH_ANYAUDIOIMPORTER) if(MAGNUM_WITH_ANYAUDIOIMPORTER)

Loading…
Cancel
Save