Skip to content

Commit

Permalink
Allow specifying FIND_SHARED_LIBS per-TPL
Browse files Browse the repository at this point in the history
Signed-off-by: Samuel E. Browne <[email protected]>
  • Loading branch information
sebrowne committed Dec 17, 2024
1 parent ade2bbb commit 7b30689
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
34 changes: 34 additions & 0 deletions test/core/ProcessEnabledTpls/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,40 @@ create_process_enabled_tpls_test_case(
)


create_process_enabled_tpls_test_case(
HeadersAndLibsTpl_Shared_PerLibrarySetting
TPL_NAME HeadersAndLibsTpl
TPL_FINDMOD ${HeadersAndLibsTpl_FINDMOD}
INCLUDE_DIRS ${HeadersAndLibsTpl_BASE_DIR}/include
LIBRARY_DIRS ${HeadersAndLibsTpl_BASE_DIR}/lib
EXTRA_ARGS -DHeadersAndLibsTpl_FIND_SHARED_LIBS=ON
PASS_REGULAR_EXPRESSION_ALL
"Processing enabled external package/TPL: HeadersAndLibsTpl .enabled explicitly, disable with -DTPL_ENABLE_HeadersAndLibsTpl=OFF."
"-- Must find at least one lib in each of the lib sets .haltpl1[;]haltpl2."
"-- Searching for libs in HeadersAndLibsTpl_LIBRARY_DIRS='.+/HeadersAndLibsTpl/lib'"
"-- Searching for a lib in the set .haltpl1.:"
"-- Searching for lib 'haltpl1' [.][.][.]"
"-- Found lib '.+/HeadersAndLibsTpl/lib/libhaltpl1.so'"
"-- Searching for a lib in the set .haltpl2.:"
"-- Searching for lib 'haltpl2' [.][.][.]"
"-- Found lib '.+/HeadersAndLibsTpl/lib/libhaltpl2.so'"
"-- TPL_HeadersAndLibsTpl_LIBRARIES='.+/HeadersAndLibsTpl/lib/libhaltpl1.so[;].+/HeadersAndLibsTpl/lib/libhaltpl2.so'"
"-- Must find at least one header in each of the header sets .HeadersAndLibsTpl_header1.hpp[;]HeadersAndLibsTpl_header2.hpp."
"-- Searching for headers in HeadersAndLibsTpl_INCLUDE_DIRS='.+/HeadersAndLibsTpl/include'"
"-- Searching for a header file in the set .HeadersAndLibsTpl_header1.hpp.:"
"-- Searching for header 'HeadersAndLibsTpl_header1.hpp' [.][.][.]"
"-- Found header '.+/HeadersAndLibsTpl/include/?/HeadersAndLibsTpl_header1.hpp'"
"-- Searching for a header file in the set .HeadersAndLibsTpl_header2.hpp.:"
"-- Searching for header 'HeadersAndLibsTpl_header2.hpp' [.][.][.]"
"-- Found header '.+/HeadersAndLibsTpl/include/?/HeadersAndLibsTpl_header2.hpp'"
"-- Found TPL 'HeadersAndLibsTpl' include dirs '.+/HeadersAndLibsTpl/include'"
"-- TPL_HeadersAndLibsTpl_INCLUDE_DIRS='.+/HeadersAndLibsTpl/include'"
"Exported TPL_HeadersAndLibsTpl_NOT_FOUND='FALSE'"
"Exported TPL_HeadersAndLibsTpl_LIBRARIES='.+/HeadersAndLibsTpl/lib/libhaltpl1.so[;].+/HeadersAndLibsTpl/lib/libhaltpl2.so'"
"Exported TPL_HeadersAndLibsTpl_INCLUDE_DIRS='.+/HeadersAndLibsTpl/include'"
)


create_process_enabled_tpls_test_case(
HeadersAndLibsTpl_Shared_FindAll_sets1
TPL_NAME HeadersAndLibsTpl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,15 @@ function(tribits_tpl_find_include_dirs_and_libraries TPL_NAME)
#print_var(TPL_CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT)
endif()

# Allow per-TPL shared lib find setting
if (NOT DEFINED ${TPL_NAME}_FIND_SHARED_LIBS)
set(${TPL_NAME}_FIND_SHARED_LIBS ${TPL_FIND_SHARED_LIBS})
endif()

#print_var(TPL_FIND_SHARED_LIBS)
#print_var(CMAKE_FIND_LIBRARY_SUFFIXES)
# Set libraries to find
if (TPL_FIND_SHARED_LIBS)
if (${TPL_NAME}_FIND_SHARED_LIBS)
# The default should be to find shared libs first
set(TPL_CMAKE_FIND_LIBRARY_SUFFIXES ${TPL_CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT})
else()
Expand Down

0 comments on commit 7b30689

Please sign in to comment.