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) ...@@ -6,7 +6,7 @@ if(OGS_BUILD_GUI)
endif() endif()
# Create the library # Create the library
ogs_add_library(BaseLib ${SOURCES}) ogs_add_library(BaseLib GENERATE_EXPORT_HEADER ${SOURCES})
target_link_libraries( target_link_libraries(
BaseLib BaseLib
......
...@@ -5,6 +5,6 @@ foreach(lib Git CMake Test) ...@@ -5,6 +5,6 @@ foreach(lib Git CMake Test)
) )
ogs_add_library( 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) endforeach(lib)
...@@ -36,7 +36,7 @@ append_source_files( ...@@ -36,7 +36,7 @@ append_source_files(
) )
append_source_files(SOURCES TwoPhaseModels) append_source_files(SOURCES TwoPhaseModels)
ogs_add_library(MaterialLib ${SOURCES}) ogs_add_library(MaterialLib GENERATE_EXPORT_HEADER ${SOURCES})
target_link_libraries( target_link_libraries(
MaterialLib PUBLIC MaterialLib_SolidModels MaterialLib_FractureModels MaterialLib PUBLIC MaterialLib_SolidModels MaterialLib_FractureModels
......
get_source_files(SOURCES) get_source_files(SOURCES)
append_source_files(SOURCES Permeability) append_source_files(SOURCES Permeability)
ogs_add_library(MaterialLib_FractureModels ${SOURCES}) ogs_add_library(MaterialLib_FractureModels GENERATE_EXPORT_HEADER ${SOURCES})
target_link_libraries( target_link_libraries(
MaterialLib_FractureModels PUBLIC MathLib PRIVATE ParameterLib NumLib MaterialLib_FractureModels PUBLIC MathLib PRIVATE ParameterLib NumLib
) )
...@@ -21,7 +21,7 @@ if(OGS_USE_PETSC) ...@@ -21,7 +21,7 @@ if(OGS_USE_PETSC)
endif() endif()
# Create the library # Create the library
ogs_add_library(MathLib ${SOURCES}) ogs_add_library(MathLib GENERATE_EXPORT_HEADER ${SOURCES})
set_target_properties(MathLib PROPERTIES LINKER_LANGUAGE CXX) set_target_properties(MathLib PROPERTIES LINKER_LANGUAGE CXX)
......
...@@ -14,7 +14,7 @@ append_source_files(SOURCES ODESolver) ...@@ -14,7 +14,7 @@ append_source_files(SOURCES ODESolver)
append_source_files(SOURCES Extrapolation) append_source_files(SOURCES Extrapolation)
# Create the library # Create the library
ogs_add_library(NumLib ${SOURCES}) ogs_add_library(NumLib GENERATE_EXPORT_HEADER ${SOURCES})
set_target_properties(NumLib PROPERTIES LINKER_LANGUAGE CXX) set_target_properties(NumLib PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries( target_link_libraries(
......
...@@ -80,7 +80,7 @@ endfunction() ...@@ -80,7 +80,7 @@ endfunction()
# Replacement for add_library() for ogs libraries # Replacement for add_library() for ogs libraries
function(ogs_add_library targetName) function(ogs_add_library targetName)
set(options STATIC SHARED) set(options STATIC SHARED GENERATE_EXPORT_HEADER)
cmake_parse_arguments(ogs_add_library "${options}" "" "" ${ARGN}) cmake_parse_arguments(ogs_add_library "${options}" "" "" ${ARGN})
foreach(file ${ogs_add_library_UNPARSED_ARGUMENTS}) foreach(file ${ogs_add_library_UNPARSED_ARGUMENTS})
...@@ -117,9 +117,11 @@ function(ogs_add_library targetName) ...@@ -117,9 +117,11 @@ function(ogs_add_library targetName)
) )
endif() endif()
include(GenerateExportHeader) if(ogs_add_library_GENERATE_EXPORT_HEADER)
generate_export_header(${targetName}) include(GenerateExportHeader)
target_include_directories(${targetName} PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) generate_export_header(${targetName})
target_include_directories(${targetName} PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
endif()
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.16) if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.16)
set_target_properties( 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