Ensure add_custom_command uses VERBATIM

https://cmake.org/cmake/help/latest/command/add_custom_command.html

"Use of VERBATIM is recommended as it enables correct behavior."

The docs basically say that this is required.
This commit is contained in:
Chris Thrasher 2022-09-14 10:42:13 -06:00 committed by Lukas Dürrenberger
parent 88f9a33479
commit ff685de1bf
2 changed files with 16 additions and 10 deletions

View File

@ -315,7 +315,8 @@ else()
# we need a dummy file in order to compile the framework
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp
COMMAND touch ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp)
COMMAND touch ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp
VERBATIM)
set(SFML_SOURCES ${SFML_HEADERS})
list(APPEND SFML_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp)
@ -346,14 +347,16 @@ else()
${PROJECT_SOURCE_DIR}/include/SFML/System.hpp
${PROJECT_SOURCE_DIR}/include/SFML/Main.hpp
${PROJECT_SOURCE_DIR}/include/SFML/System
$<TARGET_FILE_DIR:SFML>/Headers)
$<TARGET_FILE_DIR:SFML>/Headers
VERBATIM)
# add window module headers if enabled
if(SFML_BUILD_WINDOW)
add_custom_command(TARGET SFML POST_BUILD COMMAND cp -r
${PROJECT_SOURCE_DIR}/include/SFML/Window.hpp
${PROJECT_SOURCE_DIR}/include/SFML/Window
$<TARGET_FILE_DIR:SFML>/Headers)
$<TARGET_FILE_DIR:SFML>/Headers
VERBATIM)
endif()
# add network module headers if enabled
@ -361,7 +364,8 @@ else()
add_custom_command(TARGET SFML POST_BUILD COMMAND cp -r
${PROJECT_SOURCE_DIR}/include/SFML/Network.hpp
${PROJECT_SOURCE_DIR}/include/SFML/Network
$<TARGET_FILE_DIR:SFML>/Headers)
$<TARGET_FILE_DIR:SFML>/Headers
VERBATIM)
endif()
# add graphics module headers if enabled
@ -369,7 +373,8 @@ else()
add_custom_command(TARGET SFML POST_BUILD COMMAND cp -r
${PROJECT_SOURCE_DIR}/include/SFML/Graphics.hpp
${PROJECT_SOURCE_DIR}/include/SFML/Graphics
$<TARGET_FILE_DIR:SFML>/Headers)
$<TARGET_FILE_DIR:SFML>/Headers
VERBATIM)
endif()
# add audio module headers if enabled
@ -377,7 +382,8 @@ else()
add_custom_command(TARGET SFML POST_BUILD COMMAND cp -r
${PROJECT_SOURCE_DIR}/include/SFML/Audio.hpp
${PROJECT_SOURCE_DIR}/include/SFML/Audio
$<TARGET_FILE_DIR:SFML>/Headers)
$<TARGET_FILE_DIR:SFML>/Headers
VERBATIM)
endif()
# adapt install directory to allow distributing dylibs/frameworks in user's frameworks/application bundle

View File

@ -115,7 +115,7 @@ if(SFML_OS_WINDOWS AND NOT SFML_USE_SYSTEM_DEPS)
TARGET test-sfml-audio
COMMENT "Copy OpenAL DLL"
PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/extlibs/bin/$<IF:$<BOOL:${ARCH_64BITS}>,x64,x86>/openal32.dll $<TARGET_FILE_DIR:test-sfml-audio>
)
VERBATIM)
endif()
# Automatically run the tests at the end of the build
@ -153,12 +153,12 @@ if(SFML_ENABLE_COVERAGE AND OpenCppCoverage_FOUND)
add_custom_command(TARGET runtests
COMMENT "Run tests"
POST_BUILD COMMAND "${OpenCppCoverage_BINARY}" ARGS --quiet --export_type cobertura:"${PROJECT_BINARY_DIR}/coverage.out" --cover_children --excluded_modules "${COVERAGE_EXCLUDE}" --sources "${COVERAGE_SRC}" --sources "${COVERAGE_INCLUDE}" -- "${CMAKE_CTEST_COMMAND}" --output-on-failure -C $<CONFIG>
)
POST_BUILD COMMAND "${OpenCppCoverage_BINARY}" ARGS --quiet --export_type cobertura:${PROJECT_BINARY_DIR}/coverage.out --cover_children --excluded_modules "${COVERAGE_EXCLUDE}" --sources "${COVERAGE_SRC}" --sources "${COVERAGE_INCLUDE}" -- "${CMAKE_CTEST_COMMAND}" --output-on-failure -C $<CONFIG>
VERBATIM)
else()
# Run tests without a coverage runner
add_custom_command(TARGET runtests
COMMENT "Run tests"
POST_BUILD COMMAND "${CMAKE_CTEST_COMMAND}" --output-on-failure -C $<CONFIG>
)
VERBATIM)
endif()