Don't add SFML:: namespace to external targets
The SFML target export set includes a number of external targets which are not owned by the project itself. This includes targets like Freetype and OpenGL. By specifying a namespace for the export set, a SFML:: namespace was prepended to all targets. This is not a problem when using shared libraries but when building and using static libraries caused a problem where CMake was attempting and failing to find targets with names like SFML::Freetype or SFML::OpenGL which did not exist. Luckily CMake allows you put namespaces in the EXPORT_NAME target property so now we can just add the SFML:: namespace in the macro which creates SFML targets and remove the `NAMESPACE SFML::` line which was adding namespaces to all targets.
This commit is contained in:
parent
7c80f302e4
commit
8f1955af17
@ -81,7 +81,7 @@ macro(sfml_add_library module)
|
||||
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})
|
||||
set_target_properties(${target} PROPERTIES EXPORT_NAME SFML::${module})
|
||||
|
||||
# adjust the output file prefix/suffix to match our conventions
|
||||
if(BUILD_SHARED_LIBS AND NOT THIS_STATIC)
|
||||
@ -452,7 +452,6 @@ 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"
|
||||
|
Loading…
Reference in New Issue
Block a user