Skip to content
Snippets Groups Projects
Commit 56bbd5ee authored by Lars Bilke's avatar Lars Bilke
Browse files

[cmake] Added option GENERATE_EXPORT_HEADER in ogs_add_library().

parent 187df323
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,7 @@ if(OGS_BUILD_GUI)
endif()
# Create the library
ogs_add_library(BaseLib ${SOURCES})
ogs_add_library(BaseLib GENERATE_EXPORT_HEADER ${SOURCES})
target_link_libraries(
BaseLib
......
......@@ -5,6 +5,6 @@ foreach(lib Git CMake Test)
)
ogs_add_library(
${lib}InfoLib ${CMAKE_CURRENT_BINARY_DIR}/${lib}Info.cpp ${lib}Info.h
${lib}InfoLib GENERATE_EXPORT_HEADER ${CMAKE_CURRENT_BINARY_DIR}/${lib}Info.cpp ${lib}Info.h
)
endforeach(lib)
......@@ -36,7 +36,7 @@ append_source_files(
)
append_source_files(SOURCES TwoPhaseModels)
ogs_add_library(MaterialLib ${SOURCES})
ogs_add_library(MaterialLib GENERATE_EXPORT_HEADER ${SOURCES})
target_link_libraries(
MaterialLib PUBLIC MaterialLib_SolidModels MaterialLib_FractureModels
......
get_source_files(SOURCES)
append_source_files(SOURCES Permeability)
ogs_add_library(MaterialLib_FractureModels ${SOURCES})
ogs_add_library(MaterialLib_FractureModels GENERATE_EXPORT_HEADER ${SOURCES})
target_link_libraries(
MaterialLib_FractureModels PUBLIC MathLib PRIVATE ParameterLib NumLib
)
......@@ -21,7 +21,7 @@ if(OGS_USE_PETSC)
endif()
# Create the library
ogs_add_library(MathLib ${SOURCES})
ogs_add_library(MathLib GENERATE_EXPORT_HEADER ${SOURCES})
set_target_properties(MathLib PROPERTIES LINKER_LANGUAGE CXX)
......
......@@ -14,7 +14,7 @@ append_source_files(SOURCES ODESolver)
append_source_files(SOURCES Extrapolation)
# Create the library
ogs_add_library(NumLib ${SOURCES})
ogs_add_library(NumLib GENERATE_EXPORT_HEADER ${SOURCES})
set_target_properties(NumLib PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(
......
......@@ -80,7 +80,7 @@ endfunction()
# Replacement for add_library() for ogs libraries
function(ogs_add_library targetName)
set(options STATIC SHARED)
set(options STATIC SHARED GENERATE_EXPORT_HEADER)
cmake_parse_arguments(ogs_add_library "${options}" "" "" ${ARGN})
foreach(file ${ogs_add_library_UNPARSED_ARGUMENTS})
......@@ -117,9 +117,11 @@ function(ogs_add_library targetName)
)
endif()
include(GenerateExportHeader)
generate_export_header(${targetName})
target_include_directories(${targetName} PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
if(ogs_add_library_GENERATE_EXPORT_HEADER)
include(GenerateExportHeader)
generate_export_header(${targetName})
target_include_directories(${targetName} PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
endif()
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.16)
set_target_properties(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment