From 4586db91a9fe95f3a9218ef6605c46a9e42faa2f Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Tue, 28 Dec 2021 22:28:50 -0700 Subject: [PATCH] Add SFML:: namespace to targets This removes the sfml- prefixed targets from the export set. The sfml- prefixed targets are still available within the build tree but not to downstream users thus making this an API breaking change when compared to the 2.x releases. To keep things consistent, usage of the sfml- targets were replaced with their namespaced counterparts. This has a number of benefits: 1. It's more idiomatic. Modern CMake libraries are expected to have namespaced targets. 2. Namespaced targets are less likely to collide with user-defined targets. No one will accidentally define a SFML:: target. 3. If a namespaced target is not found by CMake, configuration will immediately stop. --- cmake/Macros.cmake | 18 +++++++++++------ cmake/SFMLConfig.cmake.in | 28 +++++++++++++-------------- cmake/SFMLConfigDependencies.cmake.in | 12 ++++++------ examples/X11/CMakeLists.txt | 2 +- examples/cocoa/CMakeLists.txt | 4 ++-- examples/ftp/CMakeLists.txt | 2 +- examples/island/CMakeLists.txt | 2 +- examples/joystick/CMakeLists.txt | 2 +- examples/opengl/CMakeLists.txt | 2 +- examples/shader/CMakeLists.txt | 2 +- examples/sockets/CMakeLists.txt | 2 +- examples/sound/CMakeLists.txt | 2 +- examples/sound_capture/CMakeLists.txt | 2 +- examples/tennis/CMakeLists.txt | 2 +- examples/voip/CMakeLists.txt | 2 +- examples/vulkan/CMakeLists.txt | 2 +- examples/win32/CMakeLists.txt | 2 +- examples/window/CMakeLists.txt | 2 +- src/SFML/Audio/CMakeLists.txt | 4 ++-- src/SFML/Graphics/CMakeLists.txt | 4 ++-- src/SFML/Main/CMakeLists.txt | 4 ++-- src/SFML/Network/CMakeLists.txt | 4 ++-- src/SFML/System/CMakeLists.txt | 2 +- src/SFML/Window/CMakeLists.txt | 4 ++-- test/CMakeLists.txt | 9 ++++----- 25 files changed, 63 insertions(+), 58 deletions(-) diff --git a/cmake/Macros.cmake b/cmake/Macros.cmake index f4ce333c..6ea49f35 100644 --- a/cmake/Macros.cmake +++ b/cmake/Macros.cmake @@ -50,10 +50,10 @@ function(sfml_set_common_ios_properties target) endfunction() # add a new target which is a SFML library -# example: sfml_add_library(sfml-graphics +# example: sfml_add_library(Graphics # SOURCES sprite.cpp image.cpp ... # [STATIC]) # Always create a static library and ignore BUILD_SHARED_LIBS -macro(sfml_add_library target) +macro(sfml_add_library module) # parse the arguments cmake_parse_arguments(THIS "STATIC" "" "SOURCES" ${ARGN}) @@ -62,11 +62,13 @@ macro(sfml_add_library target) endif() # create the target + string(TOLOWER sfml-${module} target) if (THIS_STATIC) add_library(${target} STATIC ${THIS_SOURCES}) else() add_library(${target} ${THIS_SOURCES}) endif() + add_library(SFML::${module} ALIAS ${target}) # enable C++17 support target_compile_features(${target} PUBLIC cxx_std_17) @@ -78,6 +80,9 @@ macro(sfml_add_library target) string(TOUPPER "${NAME_UPPER}" NAME_UPPER) set_target_properties(${target} PROPERTIES DEFINE_SYMBOL ${NAME_UPPER}_EXPORTS) + # define the export name of the module + set_target_properties(${target} PROPERTIES EXPORT_NAME ${module}) + # adjust the output file prefix/suffix to match our conventions if(BUILD_SHARED_LIBS AND NOT THIS_STATIC) if(SFML_OS_WINDOWS) @@ -232,7 +237,7 @@ endmacro() # example: sfml_add_example(ftp # SOURCES ftp.cpp ... # BUNDLE_RESOURCES MainMenu.nib ... # Files to be added in target but not installed next to the executable -# DEPENDS sfml-network +# DEPENDS SFML::Network # RESOURCES_DIR resources) # A directory to install next to the executable and sources macro(sfml_add_example target) @@ -251,7 +256,7 @@ macro(sfml_add_example target) # create the target if(THIS_GUI_APP AND SFML_OS_WINDOWS AND NOT DEFINED CMAKE_CONFIGURATION_TYPES AND ${CMAKE_BUILD_TYPE} STREQUAL "Release") add_executable(${target} WIN32 ${target_input}) - target_link_libraries(${target} PRIVATE sfml-main) + target_link_libraries(${target} PRIVATE SFML::Main) elseif(THIS_GUI_APP AND SFML_OS_IOS) # For iOS apps we need the launch screen storyboard, @@ -265,7 +270,7 @@ macro(sfml_add_example target) set_target_properties(${target} PROPERTIES RESOURCE "${RESOURCES}" MACOSX_BUNDLE_INFO_PLIST ${INFO_PLIST} MACOSX_BUNDLE_ICON_FILE icon.icns) - target_link_libraries(${target} PRIVATE sfml-main) + target_link_libraries(${target} PRIVATE SFML::Main) else() add_executable(${target} ${target_input}) endif() @@ -298,7 +303,7 @@ endmacro() # add a new target which is a SFML test # example: sfml_add_test(sfml-test # ftp.cpp ... -# sfml-network) +# SFML::Network) function(sfml_add_test target SOURCES DEPENDS) # set a source group for the source files @@ -447,6 +452,7 @@ function(sfml_export_targets) install(EXPORT SFMLConfigExport FILE ${targets_config_filename} + NAMESPACE SFML:: DESTINATION ${config_package_location}) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/SFMLConfig.cmake" diff --git a/cmake/SFMLConfig.cmake.in b/cmake/SFMLConfig.cmake.in index 26b5987f..96a79479 100644 --- a/cmake/SFMLConfig.cmake.in +++ b/cmake/SFMLConfig.cmake.in @@ -4,10 +4,10 @@ # Usage # ----- # -# When you try to locate the SFML libraries, you must specify which modules you want to use (system, window, graphics, network, audio, main). +# When you try to locate the SFML libraries, you must specify which modules you want to use (System, Window, Graphics, Network, Audio, Main). # If none is given, no imported target will be created and you won't be able to link to SFML libraries. # example: -# find_package(SFML COMPONENTS graphics window system) # find the graphics, window and system modules +# find_package(SFML COMPONENTS Graphics Window System) # find the graphics, window and system modules # # You can enforce a specific version, either MAJOR.MINOR or only MAJOR. # If nothing is specified, the version won't be checked (i.e. any version will be accepted). @@ -22,7 +22,7 @@ # they will all be configured automatically, even if you use SFML static libraries. # example: # set(SFML_STATIC_LIBRARIES TRUE) -# find_package(SFML 3 COMPONENTS network system) +# find_package(SFML 3 COMPONENTS Network System) # # When searching for SFML with find_package(), keep in mind that it will also find versions which are # in development (i.e. between two released versions), if you have them in your search path. @@ -49,24 +49,24 @@ # ------ # # This script defines the following variables: -# - For each specified module XXX (system, window, graphics, network, audio, main): +# - For each specified module XXX (System, Window, Graphics, Network, Audio, Main): # - SFML_XXX_FOUND: true if either the debug or release library of the xxx module is found # - SFML_FOUND: true if all the required modules are found # # And the following targets: -# - For each specified module XXX (system, window, graphics, network, audio, main): -# - sfml-XXX +# - For each specified module XXX (System, Window, Graphics, Network, Audio, Main): +# - SFML::XXX # The SFML targets are the same for both Debug and Release build configurations and will automatically provide # correct settings based on your currently active build configuration. The SFML targets name also do not change # when using dynamic or static SFML libraries. # # When linking against a SFML target, you do not need to specify indirect dependencies. For example, linking -# against sfml-graphics will also automatically link against sfml-window and sfml-system. +# against SFML::Graphics will also automatically link against SFML::Window and SFML::System. # # example: -# find_package(SFML 2 COMPONENTS graphics audio REQUIRED) +# find_package(SFML 3 COMPONENTS Graphics Audio REQUIRED) # add_executable(myapp ...) -# target_link_libraries(myapp sfml-graphics sfml-audio) +# target_link_libraries(myapp PRIVATE SFML::Graphics SFML::Audio) if (NOT SFML_FIND_COMPONENTS) message(FATAL_ERROR "find_package(SFML) called with no component") @@ -93,10 +93,10 @@ find_path(SFML_DOC_DIR SFML.tag # Update requested components (eg. request window component if graphics component was requested) set(FIND_SFML_SYSTEM_DEPENDENCIES "") set(FIND_SFML_MAIN_DEPENDENCIES "") -set(FIND_SFML_AUDIO_DEPENDENCIES system) -set(FIND_SFML_NETWORK_DEPENDENCIES system) -set(FIND_SFML_WINDOW_DEPENDENCIES system) -set(FIND_SFML_GRAPHICS_DEPENDENCIES window system) +set(FIND_SFML_AUDIO_DEPENDENCIES System) +set(FIND_SFML_NETWORK_DEPENDENCIES System) +set(FIND_SFML_WINDOW_DEPENDENCIES System) +set(FIND_SFML_GRAPHICS_DEPENDENCIES Window System) set(FIND_SFML_ADDITIONAL_COMPONENTS "") foreach(component ${SFML_FIND_COMPONENTS}) string(TOUPPER "${component}" UPPER_COMPONENT) @@ -130,7 +130,7 @@ if (EXISTS "${targets_config_file}") foreach (component ${SFML_FIND_COMPONENTS}) string(TOUPPER "${component}" UPPER_COMPONENT) - if (TARGET sfml-${component}) + if (TARGET SFML::${component}) set(SFML_${UPPER_COMPONENT}_FOUND TRUE) else() set(FIND_SFML_ERROR "Found SFML but requested component '${component}' is missing in the config defined in ${SFML_DIR}.") diff --git a/cmake/SFMLConfigDependencies.cmake.in b/cmake/SFMLConfigDependencies.cmake.in index 6786ad94..f17617d9 100644 --- a/cmake/SFMLConfigDependencies.cmake.in +++ b/cmake/SFMLConfigDependencies.cmake.in @@ -36,8 +36,8 @@ if(SFML_STATIC_LIBRARIES) endif() endfunction() - # sfml-window - list(FIND SFML_FIND_COMPONENTS "window" FIND_SFML_WINDOW_COMPONENT_INDEX) + # SFML::Window + list(FIND SFML_FIND_COMPONENTS "Window" FIND_SFML_WINDOW_COMPONENT_INDEX) if(FIND_SFML_WINDOW_COMPONENT_INDEX GREATER -1) if(FIND_SFML_OS_LINUX OR FIND_SFML_OS_FREEBSD) sfml_bind_dependency(TARGET X11 FRIENDLY_NAME "X11" SEARCH_NAMES "X11") @@ -56,14 +56,14 @@ if(SFML_STATIC_LIBRARIES) endif() endif() - # sfml-graphics - list(FIND SFML_FIND_COMPONENTS "graphics" FIND_SFML_GRAPHICS_COMPONENT_INDEX) + # SFML::Graphics + list(FIND SFML_FIND_COMPONENTS "Graphics" FIND_SFML_GRAPHICS_COMPONENT_INDEX) if(FIND_SFML_GRAPHICS_COMPONENT_INDEX GREATER -1) sfml_bind_dependency(TARGET Freetype FRIENDLY_NAME "FreeType" SEARCH_NAMES "freetype") endif() - # sfml-audio - list(FIND SFML_FIND_COMPONENTS "audio" FIND_SFML_AUDIO_COMPONENT_INDEX) + # SFML::Audio + list(FIND SFML_FIND_COMPONENTS "Audio" FIND_SFML_AUDIO_COMPONENT_INDEX) if(FIND_SFML_AUDIO_COMPONENT_INDEX GREATER -1) sfml_bind_dependency(TARGET OpenAL FRIENDLY_NAME "OpenAL" SEARCH_NAMES "OpenAL" "openal" "openal32") if (NOT FIND_SFML_OS_IOS) diff --git a/examples/X11/CMakeLists.txt b/examples/X11/CMakeLists.txt index 0ff90aca..67815e8d 100644 --- a/examples/X11/CMakeLists.txt +++ b/examples/X11/CMakeLists.txt @@ -7,7 +7,7 @@ set(SRC ${SRCROOT}/X11.cpp) # define the X11 target sfml_add_example(X11Example GUI_APP SOURCES ${SRC} - DEPENDS sfml-window X11) + DEPENDS SFML::Window X11) # external dependency headers target_include_directories(X11Example SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/examples/X11) \ No newline at end of file diff --git a/examples/cocoa/CMakeLists.txt b/examples/cocoa/CMakeLists.txt index 3d91644c..b23ff8c4 100644 --- a/examples/cocoa/CMakeLists.txt +++ b/examples/cocoa/CMakeLists.txt @@ -54,8 +54,8 @@ set_source_files_properties(${RESOURCES} PROPERTIES sfml_add_example(cocoa SOURCES ${SRC} BUNDLE_RESOURCES ${RESOURCES} - DEPENDS sfml-system sfml-window sfml-graphics) + DEPENDS SFML::System SFML::Window SFML::Graphics) set_target_properties(cocoa PROPERTIES MACOSX_BUNDLE TRUE MACOSX_BUNDLE_INFO_PLIST ${SRCROOT}/resources/Cocoa-Info.plist) -target_link_libraries(cocoa PRIVATE "-framework Cocoa" "-framework Foundation" sfml-graphics) +target_link_libraries(cocoa PRIVATE "-framework Cocoa" "-framework Foundation" SFML::Graphics) diff --git a/examples/ftp/CMakeLists.txt b/examples/ftp/CMakeLists.txt index a65cb67e..b1e8fc16 100644 --- a/examples/ftp/CMakeLists.txt +++ b/examples/ftp/CMakeLists.txt @@ -7,4 +7,4 @@ set(SRC ${SRCROOT}/Ftp.cpp) # define the ftp target sfml_add_example(ftp SOURCES ${SRC} - DEPENDS sfml-network) + DEPENDS SFML::Network) diff --git a/examples/island/CMakeLists.txt b/examples/island/CMakeLists.txt index 4b2f3875..c7be4ec4 100644 --- a/examples/island/CMakeLists.txt +++ b/examples/island/CMakeLists.txt @@ -7,7 +7,7 @@ set(SRC ${SRCROOT}/Island.cpp) # define the island target sfml_add_example(island GUI_APP SOURCES ${SRC} - DEPENDS sfml-graphics + DEPENDS SFML::Graphics RESOURCES_DIR resources) # external dependency headers diff --git a/examples/joystick/CMakeLists.txt b/examples/joystick/CMakeLists.txt index 8d92f03d..195ff28f 100644 --- a/examples/joystick/CMakeLists.txt +++ b/examples/joystick/CMakeLists.txt @@ -7,5 +7,5 @@ set(SRC ${SRCROOT}/Joystick.cpp) # define the joystick target sfml_add_example(joystick GUI_APP SOURCES ${SRC} - DEPENDS sfml-graphics + DEPENDS SFML::Graphics RESOURCES_DIR resources) diff --git a/examples/opengl/CMakeLists.txt b/examples/opengl/CMakeLists.txt index fe71b784..abeaf068 100644 --- a/examples/opengl/CMakeLists.txt +++ b/examples/opengl/CMakeLists.txt @@ -15,7 +15,7 @@ endif() sfml_add_example(opengl GUI_APP SOURCES ${SRC} BUNDLE_RESOURCES ${RESOURCES} - DEPENDS sfml-graphics + DEPENDS SFML::Graphics RESOURCES_DIR resources) # external dependency headers diff --git a/examples/shader/CMakeLists.txt b/examples/shader/CMakeLists.txt index 600cb4d1..d4089adf 100644 --- a/examples/shader/CMakeLists.txt +++ b/examples/shader/CMakeLists.txt @@ -9,5 +9,5 @@ set(SRC # define the shader target sfml_add_example(shader GUI_APP SOURCES ${SRC} - DEPENDS sfml-graphics + DEPENDS SFML::Graphics RESOURCES_DIR resources) diff --git a/examples/sockets/CMakeLists.txt b/examples/sockets/CMakeLists.txt index eebc91db..93221ee8 100644 --- a/examples/sockets/CMakeLists.txt +++ b/examples/sockets/CMakeLists.txt @@ -9,4 +9,4 @@ set(SRC ${SRCROOT}/Sockets.cpp # define the sockets target sfml_add_example(sockets SOURCES ${SRC} - DEPENDS sfml-network) + DEPENDS SFML::Network) diff --git a/examples/sound/CMakeLists.txt b/examples/sound/CMakeLists.txt index d3875a6f..8369a371 100644 --- a/examples/sound/CMakeLists.txt +++ b/examples/sound/CMakeLists.txt @@ -7,5 +7,5 @@ set(SRC ${SRCROOT}/Sound.cpp) # define the sound target sfml_add_example(sound SOURCES ${SRC} - DEPENDS sfml-audio + DEPENDS SFML::Audio RESOURCES_DIR resources) diff --git a/examples/sound_capture/CMakeLists.txt b/examples/sound_capture/CMakeLists.txt index e2c457f8..ce416d60 100644 --- a/examples/sound_capture/CMakeLists.txt +++ b/examples/sound_capture/CMakeLists.txt @@ -7,4 +7,4 @@ set(SRC ${SRCROOT}/SoundCapture.cpp) # define the sound-capture target sfml_add_example(sound-capture SOURCES ${SRC} - DEPENDS sfml-audio) + DEPENDS SFML::Audio) diff --git a/examples/tennis/CMakeLists.txt b/examples/tennis/CMakeLists.txt index d2699368..84c7a5f2 100644 --- a/examples/tennis/CMakeLists.txt +++ b/examples/tennis/CMakeLists.txt @@ -14,5 +14,5 @@ endif() sfml_add_example(tennis GUI_APP SOURCES ${SRC} BUNDLE_RESOURCES ${RESOURCES} - DEPENDS sfml-audio sfml-graphics + DEPENDS SFML::Audio SFML::Graphics RESOURCES_DIR resources) diff --git a/examples/voip/CMakeLists.txt b/examples/voip/CMakeLists.txt index 66bc0747..a5e14c3f 100644 --- a/examples/voip/CMakeLists.txt +++ b/examples/voip/CMakeLists.txt @@ -9,4 +9,4 @@ set(SRC ${SRCROOT}/VoIP.cpp # define the voip target sfml_add_example(voip SOURCES ${SRC} - DEPENDS sfml-audio sfml-network) + DEPENDS SFML::Audio SFML::Network) diff --git a/examples/vulkan/CMakeLists.txt b/examples/vulkan/CMakeLists.txt index e35c091d..b1c37d97 100644 --- a/examples/vulkan/CMakeLists.txt +++ b/examples/vulkan/CMakeLists.txt @@ -7,7 +7,7 @@ set(SRC ${SRCROOT}/Vulkan.cpp) # define the window target sfml_add_example(vulkan GUI_APP SOURCES ${SRC} - DEPENDS sfml-graphics + DEPENDS SFML::Graphics RESOURCES_DIR resources) # external dependency headers diff --git a/examples/win32/CMakeLists.txt b/examples/win32/CMakeLists.txt index bd952c5e..87c5c18a 100644 --- a/examples/win32/CMakeLists.txt +++ b/examples/win32/CMakeLists.txt @@ -7,5 +7,5 @@ set(SRC ${SRCROOT}/Win32.cpp) # define the win32 target sfml_add_example(win32 GUI_APP SOURCES ${SRC} - DEPENDS sfml-graphics + DEPENDS SFML::Graphics RESOURCES_DIR resources) diff --git a/examples/window/CMakeLists.txt b/examples/window/CMakeLists.txt index ccb1d6c5..3b1314ac 100644 --- a/examples/window/CMakeLists.txt +++ b/examples/window/CMakeLists.txt @@ -7,7 +7,7 @@ set(SRC ${SRCROOT}/Window.cpp) # define the window target sfml_add_example(window GUI_APP SOURCES ${SRC} - DEPENDS sfml-window) + DEPENDS SFML::Window) # external dependency headers target_include_directories(window SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/examples/window) \ No newline at end of file diff --git a/src/SFML/Audio/CMakeLists.txt b/src/SFML/Audio/CMakeLists.txt index d27dc6d5..ccbbd8f3 100644 --- a/src/SFML/Audio/CMakeLists.txt +++ b/src/SFML/Audio/CMakeLists.txt @@ -77,7 +77,7 @@ target_compile_definitions(VORBIS INTERFACE "OV_EXCLUDE_STATIC_CALLBACKS") target_compile_definitions(FLAC INTERFACE "FLAC__NO_DLL") # define the sfml-audio target -sfml_add_library(sfml-audio +sfml_add_library(Audio SOURCES ${SRC} ${CODECS_SRC}) # setup dependencies @@ -91,5 +91,5 @@ if(SFML_OS_ANDROID) endif() target_link_libraries(sfml-audio - PUBLIC sfml-system + PUBLIC SFML::System PRIVATE VORBIS FLAC) diff --git a/src/SFML/Graphics/CMakeLists.txt b/src/SFML/Graphics/CMakeLists.txt index 58d4a58d..28d79137 100644 --- a/src/SFML/Graphics/CMakeLists.txt +++ b/src/SFML/Graphics/CMakeLists.txt @@ -87,11 +87,11 @@ source_group("render texture" FILES ${RENDER_TEXTURE_SRC}) # define the sfml-graphics target -sfml_add_library(sfml-graphics +sfml_add_library(Graphics SOURCES ${SRC} ${DRAWABLES_SRC} ${RENDER_TEXTURE_SRC} ${STB_SRC}) # setup dependencies -target_link_libraries(sfml-graphics PUBLIC sfml-window) +target_link_libraries(sfml-graphics PUBLIC SFML::Window) # stb_image sources target_include_directories(sfml-graphics SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/stb_image") diff --git a/src/SFML/Main/CMakeLists.txt b/src/SFML/Main/CMakeLists.txt index babd2b32..f889768a 100644 --- a/src/SFML/Main/CMakeLists.txt +++ b/src/SFML/Main/CMakeLists.txt @@ -14,7 +14,7 @@ else() endif() # define the sfml-main target -sfml_add_library(sfml-main STATIC SOURCES ${SRC}) +sfml_add_library(Main STATIC SOURCES ${SRC}) if(SFML_OS_ANDROID) # glad sources @@ -32,5 +32,5 @@ set_target_properties(sfml-main PROPERTIES # from depending on shared libraries), we need a boostrap activity which # will load our shared libraries manually if(SFML_OS_ANDROID) - sfml_add_library(sfml-activity SOURCES ${SRCROOT}/SFMLActivity.cpp) + sfml_add_library(Activity SOURCES ${SRCROOT}/SFMLActivity.cpp) endif() diff --git a/src/SFML/Network/CMakeLists.txt b/src/SFML/Network/CMakeLists.txt index 6626d734..d46ad12e 100644 --- a/src/SFML/Network/CMakeLists.txt +++ b/src/SFML/Network/CMakeLists.txt @@ -45,11 +45,11 @@ endif() source_group("" FILES ${SRC}) # define the sfml-network target -sfml_add_library(sfml-network +sfml_add_library(Network SOURCES ${SRC}) # setup dependencies -target_link_libraries(sfml-network PUBLIC sfml-system) +target_link_libraries(sfml-network PUBLIC SFML::System) if(SFML_OS_WINDOWS) target_link_libraries(sfml-network PRIVATE ws2_32) endif() diff --git a/src/SFML/System/CMakeLists.txt b/src/SFML/System/CMakeLists.txt index b3753f89..7aebfa55 100644 --- a/src/SFML/System/CMakeLists.txt +++ b/src/SFML/System/CMakeLists.txt @@ -47,7 +47,7 @@ endif() source_group("unix" FILES ${PLATFORM_SRC}) # define the sfml-system target -sfml_add_library(sfml-system +sfml_add_library(System SOURCES ${SRC} ${PLATFORM_SRC}) if(SFML_OS_ANDROID) diff --git a/src/SFML/Window/CMakeLists.txt b/src/SFML/Window/CMakeLists.txt index 5b2852ac..c39a3e1d 100644 --- a/src/SFML/Window/CMakeLists.txt +++ b/src/SFML/Window/CMakeLists.txt @@ -234,9 +234,9 @@ elseif(SFML_OS_ANDROID) endif() # define the sfml-window target -sfml_add_library(sfml-window +sfml_add_library(Window SOURCES ${SRC} ${PLATFORM_SRC}) -target_link_libraries(sfml-window PUBLIC sfml-system) +target_link_libraries(sfml-window PUBLIC SFML::System) # glad sources target_include_directories(sfml-window SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/glad/include") diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 87429d20..3d5b6d50 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -15,8 +15,7 @@ SET(SYSTEM_SRC "${SRCROOT}/TestUtilities/SystemUtil.hpp" "${SRCROOT}/TestUtilities/SystemUtil.cpp" ) - -sfml_add_test(test-sfml-system "${SYSTEM_SRC}" sfml-system) +sfml_add_test(test-sfml-system "${SYSTEM_SRC}" SFML::System) target_link_libraries(test-sfml-system PRIVATE sfml-test-main) if(SFML_BUILD_WINDOW) @@ -25,7 +24,7 @@ if(SFML_BUILD_WINDOW) "${SRCROOT}/TestUtilities/WindowUtil.hpp" "${SRCROOT}/TestUtilities/WindowUtil.cpp" ) - sfml_add_test(test-sfml-window "${WINDOW_SRC}" sfml-window) + sfml_add_test(test-sfml-window "${WINDOW_SRC}" SFML::Window) target_link_libraries(test-sfml-window PRIVATE sfml-test-main) endif() @@ -38,7 +37,7 @@ if(SFML_BUILD_GRAPHICS) "${SRCROOT}/TestUtilities/GraphicsUtil.hpp" "${SRCROOT}/TestUtilities/GraphicsUtil.cpp" ) - sfml_add_test(test-sfml-graphics "${GRAPHICS_SRC}" sfml-graphics) + sfml_add_test(test-sfml-graphics "${GRAPHICS_SRC}" SFML::Graphics) target_link_libraries(test-sfml-graphics PRIVATE sfml-test-main) endif() @@ -46,7 +45,7 @@ if(SFML_BUILD_NETWORK) SET(NETWORK_SRC "${SRCROOT}/Network/Packet.cpp" ) - sfml_add_test(test-sfml-network "${NETWORK_SRC}" sfml-network) + sfml_add_test(test-sfml-network "${NETWORK_SRC}" SFML::Network) target_link_libraries(test-sfml-network PRIVATE sfml-test-main) endif()