Merge pull request #3363 from malortie/fix-cmake-override-output-path3
Fixed runtime output directory overridden.pull/3366/head
commit
f90bb2ca26
|
@ -333,19 +333,20 @@ ENDIF()
|
|||
INCLUDE (FindPkgMacros)
|
||||
INCLUDE (PrecompiledHeader)
|
||||
|
||||
# If this is an in-source build (CMAKE_SOURCE_DIR == CMAKE_BINARY_DIR),
|
||||
# write the library/executable files to the respective directories in the
|
||||
# source tree. During an out-of-source build, however, do not litter this
|
||||
# directory, since that is probably what the user wanted to avoid.
|
||||
IF ( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
|
||||
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_HOME_DIRECTORY}/bin" )
|
||||
SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_HOME_DIRECTORY}/lib" )
|
||||
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_HOME_DIRECTORY}/bin" )
|
||||
ELSE()
|
||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
|
||||
ENDIF ()
|
||||
# Set Assimp project output directory variables.
|
||||
SET(ASSIMP_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
|
||||
SET(ASSIMP_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
|
||||
SET(ASSIMP_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
|
||||
|
||||
# Macro used to set the output directories of a target to the
|
||||
# respective Assimp output directories.
|
||||
MACRO(TARGET_USE_COMMON_OUTPUT_DIRECTORY target)
|
||||
set_target_properties(${target} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${ASSIMP_RUNTIME_OUTPUT_DIRECTORY}
|
||||
LIBRARY_OUTPUT_DIRECTORY ${ASSIMP_LIBRARY_OUTPUT_DIRECTORY}
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${ASSIMP_ARCHIVE_OUTPUT_DIRECTORY}
|
||||
)
|
||||
ENDMACRO()
|
||||
|
||||
get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG)
|
||||
|
||||
|
|
|
@ -1136,6 +1136,8 @@ ENDIF ()
|
|||
ADD_LIBRARY( assimp ${assimp_src} )
|
||||
ADD_LIBRARY(assimp::assimp ALIAS assimp)
|
||||
|
||||
TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp)
|
||||
|
||||
# enable warnings as errors ########################################
|
||||
IF (MSVC)
|
||||
TARGET_COMPILE_OPTIONS(assimp PRIVATE /WX)
|
||||
|
|
|
@ -44,6 +44,8 @@ ADD_EXECUTABLE( ${SAMPLE_PROJECT_NAME}
|
|||
Sample_SimpleOpenGL.c
|
||||
)
|
||||
|
||||
TARGET_USE_COMMON_OUTPUT_DIRECTORY(${SAMPLE_PROJECT_NAME})
|
||||
|
||||
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} )
|
||||
|
|
|
@ -37,6 +37,8 @@ ADD_EXECUTABLE( assimp_simpletextureddirectx11 WIN32
|
|||
${SAMPLES_SHARED_CODE_DIR}/UTFConverter.h
|
||||
)
|
||||
|
||||
TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp_simpletextureddirectx11)
|
||||
|
||||
SET_PROPERTY(TARGET assimp_simpletextureddirectx11 PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
|
||||
|
||||
TARGET_LINK_LIBRARIES( assimp_simpletextureddirectx11 assimp comctl32.lib winmm.lib )
|
||||
|
|
|
@ -34,6 +34,8 @@ ADD_EXECUTABLE( assimp_simpletexturedogl WIN32
|
|||
${SAMPLES_SHARED_CODE_DIR}/UTFConverter.h
|
||||
)
|
||||
|
||||
TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp_simpletexturedogl)
|
||||
|
||||
SET_PROPERTY(TARGET assimp_simpletexturedogl PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
|
||||
|
||||
TARGET_LINK_LIBRARIES( assimp_simpletexturedogl assimp ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} )
|
||||
|
|
|
@ -208,6 +208,8 @@ add_executable( unit
|
|||
${POST_PROCESSES}
|
||||
)
|
||||
|
||||
TARGET_USE_COMMON_OUTPUT_DIRECTORY(unit)
|
||||
|
||||
add_definitions(-DASSIMP_TEST_MODELS_DIR="${CMAKE_CURRENT_LIST_DIR}/models")
|
||||
add_definitions(-DASSIMP_TEST_MODELS_NONBSD_DIR="${CMAKE_CURRENT_LIST_DIR}/models-nonbsd")
|
||||
|
||||
|
|
|
@ -59,6 +59,8 @@ ADD_EXECUTABLE( assimp_cmd
|
|||
Export.cpp
|
||||
)
|
||||
|
||||
TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp_cmd)
|
||||
|
||||
SET_PROPERTY(TARGET assimp_cmd PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
|
||||
|
||||
TARGET_LINK_LIBRARIES( assimp_cmd assimp ${ZLIB_LIBRARIES} )
|
||||
|
|
|
@ -86,6 +86,8 @@ ADD_EXECUTABLE( assimp_viewer WIN32
|
|||
txi.bmp
|
||||
)
|
||||
|
||||
TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp_viewer)
|
||||
|
||||
SET_PROPERTY(TARGET assimp_viewer PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
|
||||
|
||||
IF ( MSVC )
|
||||
|
|
Loading…
Reference in New Issue