cmake: Set INTERFACE_* properties

Otherwise, target_link_libraries would be unable to find the library
path when using a target name e.g.: rhash::rhash.


git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9592 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: ac76245db02518aa3d922d3655827259bbabfa54
Former-commit-id: 0b2d4fddd88c70ed19861d3e2d53bce395e92947
This commit is contained in:
xavi92 2024-10-27 08:00:07 +00:00
parent 2cd6611844
commit 84f03be13d
3 changed files with 13 additions and 7 deletions

View file

@ -46,9 +46,8 @@ find_package_handle_standard_args(minizip
if(minizip_FOUND)
if(NOT TARGET minizip::minizip)
add_library(minizip::minizip INTERFACE IMPORTED)
target_include_directories(minizip::minizip
INTERFACE "${minizip_INCLUDE_DIRS}")
set_target_properties(minizip::minizip PROPERTIES
IMPORTED_LOCATION "${minizip_LIBRARIES}")
INTERFACE_INCLUDE_DIRECTORIES "${minizip_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${minizip_LIBRARIES}")
endif()
endif()

View file

@ -31,9 +31,8 @@ find_package_handle_standard_args(rhash
if(rhash_FOUND)
if(NOT TARGET rhash::rhash)
add_library(rhash::rhash INTERFACE IMPORTED)
target_include_directories(rhash::rhash
INTERFACE "${rhash_INCLUDE_DIRS}")
set_target_properties(rhash::rhash PROPERTIES
IMPORTED_LOCATION "${rhash_LIBRARIES}")
INTERFACE_INCLUDE_DIRECTORIES "${rhash_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${rhash_LIBRARIES}")
endif()
endif()

View file

@ -130,7 +130,15 @@ SD_ADD_LIBRARY(legacymenu MODULE ${LEGACYMENU_SOURCES} ${LEGACYMENU_HEADERS})
find_package(rhash REQUIRED)
ADD_SDLIB_LIBRARY(legacymenu portability tgf tgfclient tgfdata ${NETWORKING_LIB} rhash)
ADD_SDLIB_LIBRARY(legacymenu
portability
tgf
tgfclient
tgfdata
${NETWORKING_LIB}
minizip::minizip
rhash::rhash
)
target_compile_features(legacymenu PRIVATE cxx_std_11)
set_target_properties(legacymenu PROPERTIES CXX_STANDARD 11 CXX_EXTENSIONS OFF)