Skip to content

Commit

Permalink
[cmake] Fix linking of the cmake target to re2 in static linking
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Nov 18, 2023
1 parent c1b2af4 commit 468d97e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cmake/OssiaConfiguration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,12 @@ else()

if(CMAKE_COMPILER_IS_GNUCXX)
set(OSSIA_LINK_OPTIONS ${OSSIA_LINK_OPTIONS}
-fvar-tracking-assignments
$<BUILD_INTERFACE:-fvar-tracking-assignments>
)

# Note: this may fail with -gsplit-dwarf
set(OSSIA_LINK_OPTIONS ${OSSIA_LINK_OPTIONS}
-Wl,-Bsymbolic-functions
$<BUILD_INTERFACE:-Wl,-Bsymbolic-functions>
)
endif()

Expand Down
14 changes: 13 additions & 1 deletion cmake/ossiaConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ include(CMakeFindDependencyMacro)

get_filename_component(OSSIA_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)

list(APPEND CMAKE_MODULE_PATH ${OSSIA_CMAKE_DIR})
list(APPEND CMAKE_MODULE_PATH "${OSSIA_CMAKE_DIR}")
find_dependency(Boost 1.83 REQUIRED)

if(@OSSIA_STATIC@)
if(EXISTS "${OSSIA_CMAKE_DIR}/../re2/re2-exports.cmake")
include("${OSSIA_CMAKE_DIR}/../re2/re2-exports.cmake")
endif()
endif()

list(REMOVE_AT CMAKE_MODULE_PATH -1)

if(NOT TARGET ossia::ossia)
Expand All @@ -30,4 +36,10 @@ target_compile_definitions(ossia::ossia INTERFACE
SPDLOG_DEBUG_ON=1
SPDLOG_TRACE_ON=1
)

if(@OSSIA_STATIC@)
if(TARGET re2)
target_link_libraries(ossia::ossia INTERFACE re2)
endif()
endif()
endif()

0 comments on commit 468d97e

Please sign in to comment.