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

fix: fix symbol export on Windows + use target properties #922

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
11 changes: 8 additions & 3 deletions CMakeLists.txt
Expand Up @@ -16,8 +16,10 @@ endif ()
## Main library build
##

set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)
if (BUILD_SHARED_LIBS)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)
endif()
aminya marked this conversation as resolved.
Show resolved Hide resolved
aminya marked this conversation as resolved.
Show resolved Hide resolved

add_library(tinyxml2 tinyxml2.cpp tinyxml2.h)
add_library(tinyxml2::tinyxml2 ALIAS tinyxml2)
Expand All @@ -36,11 +38,14 @@ target_compile_definitions(
set_target_properties(
tinyxml2
PROPERTIES
DEFINE_SYMBOL "TINYXML2_EXPORT"
aminya marked this conversation as resolved.
Show resolved Hide resolved
VERSION "${tinyxml2_VERSION}"
SOVERSION "${tinyxml2_VERSION_MAJOR}"
)

if(BUILD_SHARED_LIBS)
target_compile_definitions(tinyxml2 PRIVATE "TINYXML2_EXPORT")
endif()

aminya marked this conversation as resolved.
Show resolved Hide resolved
if (tinyxml2_BUILD_TESTING)
add_executable(xmltest xmltest.cpp)
target_link_libraries(xmltest PRIVATE tinyxml2::tinyxml2)
Expand Down
2 changes: 1 addition & 1 deletion tinyxml2.h
Expand Up @@ -72,7 +72,7 @@ distribution.
# else
# define TINYXML2_LIB
# endif
#elif __GNUC__ >= 4
#elif defined(TINYXML2_EXPORT) && __GNUC__ >= 4
# define TINYXML2_LIB __attribute__((visibility("default")))
#else
# define TINYXML2_LIB
Expand Down