Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set that same options on the objc-static target as the objc target #211

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 16 additions & 2 deletions CMakeLists.txt
Expand Up @@ -370,21 +370,35 @@ set_property(TARGET PROPERTY NO_SONAME true)
set(BUILD_STATIC_LIBOBJC false CACHE BOOL
"Build the static version of libobjc")
if (BUILD_STATIC_LIBOBJC)
add_library(objc-static STATIC ${libobjc_C_SRCS} ${libobjc_ASM_SRCS} ${libobjc_OBJC_SRCS} ${libobjc_CXX_SRCS})
add_library(objc-static STATIC ${libobjc_C_SRCS} ${libobjc_ASM_SRCS} ${libobjc_OBJC_SRCS} ${libobjc_OBJCXX_SRCS} ${libobjc_ASM_OBJS})
set_target_properties(objc-static PROPERTIES
LINKER_LANGUAGE C
POSITION_INDEPENDENT_CODE true
OUTPUT_NAME ${LIBOBJC_NAME})
OUTPUT_NAME ${LIBOBJC_NAME}
LINK_FLAGS "${objc_LINK_FLAGS}")
list(APPEND INSTALL_TARGETS objc-static)
if (ENABLE_OBJCXX)
if (NOT CXXRT_IS_STDLIB)
target_link_libraries(objc-static ${CXX_RUNTIME})
endif()
target_sources(objc-static PRIVATE ${libobjc_CXX_SRCS})
endif()
endif ()

# Explicitly link libgc if we are compiling with gc support.
if (LIBGC)
target_link_libraries(objc ${LIBGC})
if (BUILD_STATIC_LIBOBJC)
target_link_libraries(objc-static ${LIBGC})
endif ()
endif ()

# Explicitly link libm, as an implicit dependency of the C++ runtime
if (M_LIBRARY)
target_link_libraries(objc ${M_LIBRARY})
if (BUILD_STATIC_LIBOBJC)
target_link_libraries(objc-static ${M_LIBRARY})
endif ()
endif ()

# Make weak symbols work on OS X
Expand Down