Commit 213e0d99 authored by Michael Kuron's avatar Michael Kuron 🔬

Call target_link_libraries with PUBLIC keyword if necessary

parent b6c6e2dd
Pipeline #13557 passed with stages
in 299 minutes and 5 seconds
......@@ -129,6 +129,11 @@ list( APPEND WALBERLA_MODULE_DIRS "${walberla_SOURCE_DIR}/src" "${walberla_SOURC
list( REMOVE_DUPLICATES WALBERLA_MODULE_DIRS )
set ( WALBERLA_MODULE_DIRS ${WALBERLA_MODULE_DIRS} CACHE INTERNAL "All folders that contain modules or tests" )
# target_link_libraries needs to called with keywords everywhere if it is called with keywords once
if( DEFINED CUDA_LINK_LIBRARIES_KEYWORD AND NOT CUDA_LINK_LIBRARIES_KEYWORD STREQUAL "" )
set( WALBERLA_LINK_LIBRARIES_KEYWORD PUBLIC )
endif()
############################################################################################################################
......
......@@ -26,7 +26,7 @@ if ( WALBERLA_BUILD_WITH_PYTHON_MODULE )
add_library( walberla_cpp SHARED PythonModule.cpp )
endif()
target_link_libraries( walberla_cpp ${pythonModules} ${SERVICE_LIBS} )
target_link_libraries( walberla_cpp ${WALBERLA_LINK_LIBRARIES_KEYWORD} ${pythonModules} ${SERVICE_LIBS} )
set_target_properties( walberla_cpp PROPERTIES PREFIX "")
if ( APPLE )
set_target_properties( walberla_cpp PROPERTIES SUFFIX ".so")
......
......@@ -228,7 +228,7 @@ function ( waLBerla_add_executable )
set_source_files_properties( ${generatedSourceFiles} PROPERTIES GENERATED TRUE )
target_link_modules ( ${ARG_NAME} ${ARG_DEPENDS} )
target_link_libraries( ${ARG_NAME} ${SERVICE_LIBS} )
target_link_libraries( ${ARG_NAME} ${WALBERLA_LINK_LIBRARIES_KEYWORD} ${SERVICE_LIBS} )
set_property( TARGET ${ARG_NAME} PROPERTY CXX_STANDARD 14 )
if( WALBERLA_GROUP_PROJECTS )
......
......@@ -31,7 +31,7 @@
# This mechanism is just for convenience, one can simply compile an application that uses walberla modules
# by standard cmake mechanisms:
# add_executable ( myApp ${mySourceFiles} )
# target_link_libraries ( myApp walberlaModule1 core-field lbm-boundary )
# target_link_libraries ( myApp ${WALBERLA_LINK_LIBRARIES_KEYWORD} walberlaModule1 core-field lbm-boundary )
# The difference here is that all transitively depending modules also have to be specified manually.
# i.e. assume core-field depends on core-stencil, then core-stencil has to be added by hand.
# If you use waLBerla_add_executable , these dependent modules are added automatically.
......@@ -202,7 +202,7 @@ function ( target_link_modules target )
if( TARGET ${libraryName} )
get_target_property( target_type ${libraryName} TYPE )
if( ${target_type} MATCHES LIBRARY )
target_link_libraries( ${target} ${libraryName} )
target_link_libraries( ${target} ${WALBERLA_LINK_LIBRARIES_KEYWORD} ${libraryName} )
endif( )
endif( )
endforeach()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment