CMake: Use a generator expression to mitigate make's warning spam on the Xcode generator.

This commit is contained in:
Donny Lawrence 2019-06-05 12:52:50 -05:00 committed by Sam Edwards
parent 27fd87983a
commit 3eb1895811
2 changed files with 21 additions and 4 deletions

View File

@ -51,7 +51,14 @@ function(add_python_target target)
target_link_libraries(${target} PKG::PYTHON)
if(BUILD_SHARED_LIBS)
set(_outdir "${PROJECT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${slash_namespace}")
if(CMAKE_GENERATOR STREQUAL "Xcode")
# This is explained in CompilerFlags.cmake
set(intdir $<CONFIG>$(EFFECTIVE_PLATFORM_NAME))
else()
set(intdir ${CMAKE_CFG_INTDIR})
endif()
set(_outdir "${PROJECT_BINARY_DIR}/${intdir}/${slash_namespace}")
set_target_properties(${target} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${_outdir}"

View File

@ -29,9 +29,19 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Set up the output directory structure, mimicking that of makepanda
set(CMAKE_BINARY_DIR "${CMAKE_BINARY_DIR}/cmake")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib")
if(CMAKE_GENERATOR STREQUAL "Xcode")
# On the Xcode generator, CMake generates a separate make target definition for
# every config, so it ends up spamming warnings once we try to build.
set(intdir $<CONFIG>$(EFFECTIVE_PLATFORM_NAME))
else()
set(intdir ${CMAKE_CFG_INTDIR})
endif()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${intdir}/bin")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${intdir}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${intdir}/lib")
set(MODULE_DESTINATION "lib")
# Runtime code assumes that dynamic modules have a "lib" prefix; Windows