Skip to content

Commit

Permalink
Don't link fmt-header-only directly when building a static lib
Browse files Browse the repository at this point in the history
  • Loading branch information
kcat committed Dec 3, 2024
1 parent c26b3d8 commit c238f73
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1371,7 +1371,16 @@ add_custom_target(clang-tidy-check ${CLANG_TIDY_EXECUTABLE} -format-style=file -
if(LIBTYPE STREQUAL "STATIC")
add_library(${IMPL_TARGET} STATIC ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS} ${CORE_OBJS})
target_compile_definitions(${IMPL_TARGET} PUBLIC AL_LIBTYPE_STATIC)
target_link_libraries(${IMPL_TARGET} PRIVATE ${LINKER_FLAGS} ${EXTRA_LIBS} ${MATH_LIB} alsoft::fmt-header-only)
# Instead of "linking" with the fmt-header-only interface target, which
# puts an unwanted dependency on the target when exporting/installing, just
# copy the properties.
target_compile_definitions(${IMPL_TARGET} PRIVATE
$<TARGET_PROPERTY:alsoft::fmt-header-only,INTERFACE_COMPILE_DEFINITIONS>)
target_include_directories(${IMPL_TARGET} PRIVATE
$<TARGET_PROPERTY:alsoft::fmt-header-only,INTERFACE_INCLUDE_DIRECTORIES>)
target_compile_options(${IMPL_TARGET} PRIVATE
$<TARGET_PROPERTY:alsoft::fmt-header-only,INTERFACE_COMPILE_OPTIONS>)
target_link_libraries(${IMPL_TARGET} PRIVATE ${LINKER_FLAGS} ${EXTRA_LIBS} ${MATH_LIB})

if(WIN32)
# This option is for static linking OpenAL Soft into another project
Expand Down
4 changes: 0 additions & 4 deletions fmt-11.0.2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ set_target_properties(alsoft.fmt PROPERTIES ${ALSOFT_STD_VERSION_PROPS}
COMPILE_PDB_NAME "fmt"
COMPILE_PDB_NAME_DEBUG "fmt${ALSOFT_FMT_DEBUG_POSTFIX}")

if (BUILD_SHARED_LIBS)
target_compile_definitions(alsoft.fmt PRIVATE FMT_LIB_EXPORT INTERFACE FMT_SHARED)
endif ()

add_library(alsoft.fmt-header-only INTERFACE)
add_library(alsoft::fmt-header-only ALIAS alsoft.fmt-header-only)

Expand Down

0 comments on commit c238f73

Please sign in to comment.