diff --git a/CMakeLists.txt b/CMakeLists.txt index b69e33b1a..e634876c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -163,9 +163,9 @@ if(SFML_USE_SYSTEM_DEPS) message(FATAL_ERROR "XCode templates installation cannot be used with the SFML_USE_SYSTEM_DEPS option (the bundled frameworks are required.)") endif() - file(GLOB_RECURSE DEP_LIBS "${CMAKE_SOURCE_DIR}/extlibs/libs*/*") - file(GLOB_RECURSE DEP_BINS "${CMAKE_SOURCE_DIR}/extlibs/bin*/*") - file(GLOB_RECURSE DEP_HEADERS "${CMAKE_SOURCE_DIR}/extlibs/headers/*") + file(GLOB_RECURSE DEP_LIBS "${PROJECT_SOURCE_DIR}/extlibs/libs*/*") + file(GLOB_RECURSE DEP_BINS "${PROJECT_SOURCE_DIR}/extlibs/bin*/*") + file(GLOB_RECURSE DEP_HEADERS "${PROJECT_SOURCE_DIR}/extlibs/headers/*") foreach(DEP_FILE ${DEP_LIBS} ${DEP_BINS} ${DEP_HEADERS}) get_filename_component(DEP_DIR ${DEP_FILE} PATH) @@ -175,7 +175,7 @@ if(SFML_USE_SYSTEM_DEPS) endif() get_filename_component(DEP_PARENT_DIR ${DEP_DIR} PATH) - while(NOT DEP_PARENT_DIR STREQUAL "${CMAKE_SOURCE_DIR}/extlibs") + while(NOT DEP_PARENT_DIR STREQUAL "${PROJECT_SOURCE_DIR}/extlibs") if(NOT DEP_DIR MATCHES "/(stb_image|minimp3)(/|$)") list(APPEND CMAKE_IGNORE_PATH "${DEP_PARENT_DIR}") endif() @@ -470,7 +470,7 @@ elseif(SFML_OS_MACOSX) elseif(SFML_OS_IOS) # fix CMake install rules broken for iOS (see http://public.kitware.com/Bug/view.php?id=12506) - install(DIRECTORY "${CMAKE_BINARY_DIR}/lib/\$ENV{CONFIGURATION}/" DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(DIRECTORY "${PROJECT_BINARY_DIR}/lib/\$ENV{CONFIGURATION}/" DESTINATION ${CMAKE_INSTALL_LIBDIR}) if(NOT SFML_USE_SYSTEM_DEPS) # since the iOS libraries are built as static, we must install the SFML dependencies @@ -529,4 +529,4 @@ endif() sfml_set_option(CLANG_FORMAT_EXECUTABLE clang-format STRING "Override clang-format executable, requires minimum version 12") add_custom_target(format COMMAND ${CMAKE_COMMAND} "-DCLANG_FORMAT_EXECUTABLE=${CLANG_FORMAT_EXECUTABLE}" -P ./cmake/Format.cmake - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" VERBATIM) + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" VERBATIM) diff --git a/cmake/Macros.cmake b/cmake/Macros.cmake index 5a9c93924..bed4ce287 100644 --- a/cmake/Macros.cmake +++ b/cmake/Macros.cmake @@ -283,10 +283,10 @@ macro(sfml_add_example target) # For iOS apps we need the launch screen storyboard, # and a custom info.plist to use it - set(LAUNCH_SCREEN "${CMAKE_SOURCE_DIR}/examples/assets/LaunchScreen.storyboard") - set(LOGO "${CMAKE_SOURCE_DIR}/examples/assets/logo.png") - set(INFO_PLIST "${CMAKE_SOURCE_DIR}/examples/assets/info.plist") - set(ICONS "${CMAKE_SOURCE_DIR}/examples/assets/icon.icns") + set(LAUNCH_SCREEN "${PROJECT_SOURCE_DIR}/examples/assets/LaunchScreen.storyboard") + set(LOGO "${PROJECT_SOURCE_DIR}/examples/assets/logo.png") + set(INFO_PLIST "${PROJECT_SOURCE_DIR}/examples/assets/info.plist") + set(ICONS "${PROJECT_SOURCE_DIR}/examples/assets/icon.icns") add_executable(${target} MACOSX_BUNDLE ${target_input} ${LAUNCH_SCREEN} ${LOGO} ${ICONS}) set(RESOURCES ${LAUNCH_SCREEN} ${LOGO} ${ICONS}) set_target_properties(${target} PROPERTIES RESOURCE "${RESOURCES}" diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 03e4f98db..2b46dd290 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -153,7 +153,7 @@ 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:"${CMAKE_BINARY_DIR}/coverage.out" --cover_children --excluded_modules "${COVERAGE_EXCLUDE}" --sources "${COVERAGE_SRC}" --sources "${COVERAGE_INCLUDE}" -- "${CMAKE_CTEST_COMMAND}" --output-on-failure -C $ + 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 $ ) else() # Run tests without a coverage runner