diff --git a/CMakeLists.txt b/CMakeLists.txt index 90049a6d58c36f1503505c357db28c48c6b6c5d5..4d67aa978741ad89a38f6fbf603c28facce56c95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() + ############################################################################################################################ diff --git a/apps/pythonmodule/CMakeLists.txt b/apps/pythonmodule/CMakeLists.txt index e6ab8af9d05efd1fc8bdb8cd8112fef67071636d..820784e2b07eff267fd275b8ae36dd60341f43c3 100644 --- a/apps/pythonmodule/CMakeLists.txt +++ b/apps/pythonmodule/CMakeLists.txt @@ -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") diff --git a/cmake/waLBerlaFunctions.cmake b/cmake/waLBerlaFunctions.cmake index d62c6824b202820eabda59bc3bd61d463ac6f31e..da1b0b20d205306a1b0a3fcaf63f0e44f6561a97 100644 --- a/cmake/waLBerlaFunctions.cmake +++ b/cmake/waLBerlaFunctions.cmake @@ -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 ) diff --git a/cmake/waLBerlaModuleDependencySystem.cmake b/cmake/waLBerlaModuleDependencySystem.cmake index 45f7dbdc7f18e72de73c17e544867bb16590b3ad..b955d81f4e5833ccba8e2122a614be6241eb46de 100644 --- a/cmake/waLBerlaModuleDependencySystem.cmake +++ b/cmake/waLBerlaModuleDependencySystem.cmake @@ -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()