Merge pull request #3363 from malortie/fix-cmake-override-output-path3

Fixed runtime output directory overridden.
pull/3366/head
Kim Kulling 2020-08-08 10:54:31 +02:00 committed by GitHub
commit f90bb2ca26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 28 additions and 13 deletions

View File

@ -333,19 +333,20 @@ ENDIF()
INCLUDE (FindPkgMacros) INCLUDE (FindPkgMacros)
INCLUDE (PrecompiledHeader) INCLUDE (PrecompiledHeader)
# If this is an in-source build (CMAKE_SOURCE_DIR == CMAKE_BINARY_DIR), # Set Assimp project output directory variables.
# write the library/executable files to the respective directories in the SET(ASSIMP_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
# source tree. During an out-of-source build, however, do not litter this SET(ASSIMP_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
# directory, since that is probably what the user wanted to avoid. SET(ASSIMP_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
IF ( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_HOME_DIRECTORY}/bin" ) # Macro used to set the output directories of a target to the
SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_HOME_DIRECTORY}/lib" ) # respective Assimp output directories.
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_HOME_DIRECTORY}/bin" ) MACRO(TARGET_USE_COMMON_OUTPUT_DIRECTORY target)
ELSE() set_target_properties(${target} PROPERTIES
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib") RUNTIME_OUTPUT_DIRECTORY ${ASSIMP_RUNTIME_OUTPUT_DIRECTORY}
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin") LIBRARY_OUTPUT_DIRECTORY ${ASSIMP_LIBRARY_OUTPUT_DIRECTORY}
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin") ARCHIVE_OUTPUT_DIRECTORY ${ASSIMP_ARCHIVE_OUTPUT_DIRECTORY}
ENDIF () )
ENDMACRO()
get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG) get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG)

View File

@ -1136,6 +1136,8 @@ ENDIF ()
ADD_LIBRARY( assimp ${assimp_src} ) ADD_LIBRARY( assimp ${assimp_src} )
ADD_LIBRARY(assimp::assimp ALIAS assimp) ADD_LIBRARY(assimp::assimp ALIAS assimp)
TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp)
# enable warnings as errors ######################################## # enable warnings as errors ########################################
IF (MSVC) IF (MSVC)
TARGET_COMPILE_OPTIONS(assimp PRIVATE /WX) TARGET_COMPILE_OPTIONS(assimp PRIVATE /WX)

View File

@ -44,6 +44,8 @@ ADD_EXECUTABLE( ${SAMPLE_PROJECT_NAME}
Sample_SimpleOpenGL.c Sample_SimpleOpenGL.c
) )
TARGET_USE_COMMON_OUTPUT_DIRECTORY(${SAMPLE_PROJECT_NAME})
SET_PROPERTY(TARGET ${SAMPLE_PROJECT_NAME} PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) SET_PROPERTY(TARGET ${SAMPLE_PROJECT_NAME} PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
TARGET_LINK_LIBRARIES( ${SAMPLE_PROJECT_NAME} assimp ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${M_LIB} ) TARGET_LINK_LIBRARIES( ${SAMPLE_PROJECT_NAME} assimp ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${M_LIB} )

View File

@ -37,6 +37,8 @@ ADD_EXECUTABLE( assimp_simpletextureddirectx11 WIN32
${SAMPLES_SHARED_CODE_DIR}/UTFConverter.h ${SAMPLES_SHARED_CODE_DIR}/UTFConverter.h
) )
TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp_simpletextureddirectx11)
SET_PROPERTY(TARGET assimp_simpletextureddirectx11 PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) SET_PROPERTY(TARGET assimp_simpletextureddirectx11 PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
TARGET_LINK_LIBRARIES( assimp_simpletextureddirectx11 assimp comctl32.lib winmm.lib ) TARGET_LINK_LIBRARIES( assimp_simpletextureddirectx11 assimp comctl32.lib winmm.lib )

View File

@ -34,6 +34,8 @@ ADD_EXECUTABLE( assimp_simpletexturedogl WIN32
${SAMPLES_SHARED_CODE_DIR}/UTFConverter.h ${SAMPLES_SHARED_CODE_DIR}/UTFConverter.h
) )
TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp_simpletexturedogl)
SET_PROPERTY(TARGET assimp_simpletexturedogl PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) SET_PROPERTY(TARGET assimp_simpletexturedogl PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
TARGET_LINK_LIBRARIES( assimp_simpletexturedogl assimp ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ) TARGET_LINK_LIBRARIES( assimp_simpletexturedogl assimp ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} )

View File

@ -208,6 +208,8 @@ add_executable( unit
${POST_PROCESSES} ${POST_PROCESSES}
) )
TARGET_USE_COMMON_OUTPUT_DIRECTORY(unit)
add_definitions(-DASSIMP_TEST_MODELS_DIR="${CMAKE_CURRENT_LIST_DIR}/models") add_definitions(-DASSIMP_TEST_MODELS_DIR="${CMAKE_CURRENT_LIST_DIR}/models")
add_definitions(-DASSIMP_TEST_MODELS_NONBSD_DIR="${CMAKE_CURRENT_LIST_DIR}/models-nonbsd") add_definitions(-DASSIMP_TEST_MODELS_NONBSD_DIR="${CMAKE_CURRENT_LIST_DIR}/models-nonbsd")

View File

@ -59,6 +59,8 @@ ADD_EXECUTABLE( assimp_cmd
Export.cpp Export.cpp
) )
TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp_cmd)
SET_PROPERTY(TARGET assimp_cmd PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) SET_PROPERTY(TARGET assimp_cmd PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
TARGET_LINK_LIBRARIES( assimp_cmd assimp ${ZLIB_LIBRARIES} ) TARGET_LINK_LIBRARIES( assimp_cmd assimp ${ZLIB_LIBRARIES} )

View File

@ -86,6 +86,8 @@ ADD_EXECUTABLE( assimp_viewer WIN32
txi.bmp txi.bmp
) )
TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp_viewer)
SET_PROPERTY(TARGET assimp_viewer PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) SET_PROPERTY(TARGET assimp_viewer PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
IF ( MSVC ) IF ( MSVC )