diff options
author | Chris Robinson <[email protected]> | 2020-04-10 08:43:59 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-04-10 08:43:59 -0700 |
commit | 0dc9b0392d30fab9faae6492c75dbe8240152019 (patch) | |
tree | 31b8a8801fb0d822b72ed559dab9e481fc368eda /CMakeLists.txt | |
parent | 35a2b0e5f8fb3b981cc72c5f19c414d8978c3534 (diff) |
Apply static-link flags directly to the target
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ac7238d..a6384858 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,11 +86,6 @@ IF(WIN32) OPTION(ALSOFT_BUILD_ROUTER "Build the router (EXPERIMENTAL; creates OpenAL32.dll and soft_oal.dll)" OFF) - # This option is mainly for static linking OpenAL Soft into another project - # that already defines the IDs. It is up to that project to ensure all - # required IDs are defined. - OPTION(ALSOFT_NO_UID_DEFS "Do not define GUIDs, IIDs, CLSIDs, or PropertyKeys" OFF) - IF(MINGW) OPTION(ALSOFT_BUILD_IMPORT_LIB "Build an import .lib using dlltool (requires sed)" ON) IF(NOT DLLTOOL) @@ -1132,12 +1127,18 @@ SET(SUBSYS_FLAG ) # Build main library IF(LIBTYPE STREQUAL "STATIC") - SET(CPP_DEFS ${CPP_DEFS} AL_LIBTYPE_STATIC) - IF(WIN32 AND ALSOFT_NO_UID_DEFS) - SET(CPP_DEFS ${CPP_DEFS} AL_NO_UID_DEFS) - ENDIF() - ADD_LIBRARY(${IMPL_TARGET} STATIC ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS}) - TARGET_LINK_LIBRARIES(${IMPL_TARGET} PRIVATE ${LINKER_FLAGS} ${EXTRA_LIBS} ${MATH_LIB}) + add_library(${IMPL_TARGET} STATIC ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS}) + target_compile_definitions(${IMPL_TARGET} PUBLIC AL_LIBTYPE_STATIC) + 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 + # that already defines the IDs. It is up to that project to ensure all + # required IDs are defined. + option(ALSOFT_NO_UID_DEFS "Do not define GUIDs, IIDs, CLSIDs, or PropertyKeys" OFF) + if(ALSOFT_NO_UID_DEFS) + target_compile_definitions(${IMPL_TARGET} PRIVATE AL_NO_UID_DEFS) + endif() + endif() ELSE() IF(WIN32) IF(MSVC) |