Skip to content

has shared link option #98

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ project(
#set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO ON CACHE STRING "")

option(MRDOX_BUILD_TESTS "Build tests" ON)
option(MRDOX_BUILD_SHARED "Link shared" OFF)

if (MRDOX_BUILD_SHARED)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this how its usually done with cmake? I mean, is there not some kind of standard switch or something?

set(MRDOX_LINK_MODE SHARED)
set(MRDOX_LINK_MODE_DEFINITION -DMRDOX_SHARED_LINK)
else()
set(MRDOX_LINK_MODE_DEFINITION -DMRDOX_STATIC_LINK)
endif()



if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(MRDOX_GCC ON)
Expand Down Expand Up @@ -84,7 +94,7 @@ file(GLOB_RECURSE LIB_SOURCES CONFIGURE_DEPENDS
source/lib/*.cpp
source/lib/*.natvis)

add_library(mrdox-api ${LIB_INCLUDES} ${LIB_SOURCES})
add_library(mrdox-api ${MRDOX_LINK_MODE} ${LIB_INCLUDES} ${LIB_SOURCES})
target_compile_features(mrdox-api PUBLIC cxx_std_20)
target_include_directories(mrdox-api
PUBLIC
Expand All @@ -95,7 +105,7 @@ target_include_directories(mrdox-api
target_compile_definitions(
mrdox-api
PUBLIC
-DMRDOX_STATIC_LINK
${MRDOX_LINK_MODE_DEFINITION}
PRIVATE
-DMRDOX_LIB
)
Expand Down
7 changes: 7 additions & 0 deletions include/mrdox/Platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ namespace mrdox {
# define MRDOX_VISIBLE

// (unknown)
#elif defined(__GNUC__)
# if defined(MRDOX_LIB) // building library
# define MRDOX_DECL
# else
# define MRDOX_DECL __attribute__((visibility("default")))
#endif
# define MRDOX_VISIBLE __attribute__((visibility("default")))
#else
# error unknown platform for dynamic linking
#endif
Expand Down