# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8.2 FATAL_ERROR)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12 FATAL_ERROR)
#INCLUDE(CMakeDependentOption)
PROJECT(MEDCoupling C CXX)
OPTION(MEDCOUPLING_USE_MPI "(Use MPI containers) - For MED this triggers the build of ParaMEDMEM." OFF)
OPTION(MEDCOUPLING_BUILD_TESTS "Build MED tests." ON)
OPTION(MEDCOUPLING_BUILD_DOC "Build MED doc." ON)
+OPTION(MEDCOUPLING_BUILD_STATIC "Build MEDCoupling library in static mode." OFF)
CMAKE_DEPENDENT_OPTION(MEDCOUPLING_PARTITIONER_METIS "Enable metis graph library in MEDPartitioner." ON "MEDCOUPLING_ENABLE_PARTITIONER" OFF)
CMAKE_DEPENDENT_OPTION(MEDCOUPLING_PARTITIONER_SCOTCH "Enable scotch graph library in MEDPartitioner." ON "MEDCOUPLING_ENABLE_PARTITIONER;NOT MEDCOUPLING_USE_MPI" OFF)
CMAKE_DEPENDENT_OPTION(MEDCOUPLING_PARTITIONER_PARMETIS "Enable parmetis graph library in MEDPartitioner." ON "MEDCOUPLING_ENABLE_PARTITIONER;MEDCOUPLING_USE_MPI" OFF)
CMAKE_DEPENDENT_OPTION(MEDCOUPLING_MEDLOADER_USE_XDR "Enable use of XDR for SauvReader." ON "NOT MEDCOUPLING_MICROMED" OFF)
ENDIF(WIN32)
+IF(MEDCOUPLING_BUILD_STATIC)
+ SET(BUILD_SHARED_LIBS 0)
+ SET(CMAKE_POSITION_INDEPENDENT_CODE 1) # -fPIC option
+ELSE()
+ SET(BUILD_SHARED_LIBS 1)
+ENDIF()
+
#
# Set list of prerequisites
# =========================
SET(PLATFORM_MMAP "-D_POSIX_MAPPED_FILES")
ENDIF(NOT WIN32)
-ADD_LIBRARY(interpkernel SHARED ${interpkernel_SOURCES})
+ADD_LIBRARY(interpkernel ${interpkernel_SOURCES})
SET_TARGET_PROPERTIES(interpkernel PROPERTIES COMPILE_FLAGS "${PLATFORM_MMAP}")
TARGET_LINK_LIBRARIES(interpkernel ${PLATFORM_LIBS})
INSTALL(TARGETS interpkernel EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${MEDCOUPLING_INSTALL_LIBS})
INSTALL(TARGETS PerfTest DESTINATION ${MEDCOUPLING_INSTALL_BINS})
ENDIF(NOT MEDCOUPLING_MICROMED)
-ADD_LIBRARY(InterpKernelTestUtils SHARED ${InterpKernelTestUtils_SOURCES})
-ADD_LIBRARY(InterpKernelTest SHARED ${InterpKernelTest_SOURCES})
+ADD_LIBRARY(InterpKernelTestUtils ${InterpKernelTestUtils_SOURCES})
+ADD_LIBRARY(InterpKernelTest ${InterpKernelTest_SOURCES})
SET(InterpKernelTest_LIBS medcoupling interpkernel ${CPPUNIT_LIBRARIES})
IF(NOT MEDCOUPLING_MICROMED)
MEDCouplingRemapper.cxx
)
-ADD_LIBRARY(medcoupling SHARED ${medcoupling_SOURCES})
+ADD_LIBRARY(medcoupling ${medcoupling_SOURCES})
TARGET_LINK_LIBRARIES(medcoupling interpkernel)
INSTALL(TARGETS medcoupling EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${MEDCOUPLING_INSTALL_LIBS})
-ADD_LIBRARY(medcouplingremapper SHARED ${medcouplingremapper_SOURCES})
+ADD_LIBRARY(medcouplingremapper ${medcouplingremapper_SOURCES})
TARGET_LINK_LIBRARIES(medcouplingremapper medcoupling)
INSTALL(TARGETS medcouplingremapper EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${MEDCOUPLING_INSTALL_LIBS})
SauvWriter.cxx
)
-ADD_LIBRARY(medloader SHARED ${medloader_SOURCES})
+ADD_LIBRARY(medloader ${medloader_SOURCES})
SET_TARGET_PROPERTIES(medloader PROPERTIES COMPILE_FLAGS "")
TARGET_LINK_LIBRARIES(medloader medcoupling ${MEDFILE_C_LIBRARIES} ${HDF5_LIBRARIES} ${MEDLOADER_XDR_LIBRARIES})
INSTALL(TARGETS medloader EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${MEDCOUPLING_INSTALL_LIBS})
ADD_DEFINITIONS(${medpartitionercpp_DEFINITIONS})
-ADD_LIBRARY(medpartitionercpp SHARED ${medpartitionercpp_SOURCES})
+ADD_LIBRARY(medpartitionercpp ${medpartitionercpp_SOURCES})
TARGET_LINK_LIBRARIES(medpartitionercpp ${medpartitionercpp_LDFLAGS} ${PLATFORM_LIBS} ${PTHREAD_LIBS})
INSTALL(TARGETS medpartitionercpp DESTINATION ${MEDCOUPLING_INSTALL_LIBS})
ENDIF(MEDCOUPLING_PARTITIONER_PARMETIS)
ENDIF(MEDCOUPLING_USE_MPI)
-ADD_LIBRARY(MEDPARTITIONERTest SHARED ${MEDPARTITIONERTest_SOURCES})
+ADD_LIBRARY(MEDPARTITIONERTest ${MEDPARTITIONERTest_SOURCES})
TARGET_LINK_LIBRARIES(MEDPARTITIONERTest ${MEDPARTITIONERTest_LDFLAGS})
INSTALL(TARGETS MEDPARTITIONERTest DESTINATION ${MEDCOUPLING_INSTALL_LIBS})
ParaMEDFileMesh.cxx
)
-ADD_LIBRARY(paramedloader SHARED ${paramedloader_SOURCES})
+ADD_LIBRARY(paramedloader ${paramedloader_SOURCES})
TARGET_LINK_LIBRARIES(paramedloader paramedmem medloader ${PLATFORM_LIBS})
INSTALL(TARGETS paramedloader EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${MEDCOUPLING_INSTALL_LIBS})
ExplicitMapping.cxx
)
-ADD_LIBRARY(paramedmem SHARED ${paramedmem_SOURCES})
+ADD_LIBRARY(paramedmem ${paramedmem_SOURCES})
TARGET_LINK_LIBRARIES(paramedmem medcoupling ${MPI_LIBRARIES})
INSTALL(TARGETS paramedmem EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${MEDCOUPLING_INSTALL_LIBS})
test_MPI_Access_ISend_IRecv_BottleNeck.cxx
)
-ADD_LIBRARY(ParaMEDMEMTest SHARED ${ParaMEDMEMTest_SOURCES})
+ADD_LIBRARY(ParaMEDMEMTest ${ParaMEDMEMTest_SOURCES})
SET_TARGET_PROPERTIES(ParaMEDMEMTest PROPERTIES COMPILE_FLAGS "")
TARGET_LINK_LIBRARIES(ParaMEDMEMTest paramedmem paramedloader medcouplingremapper InterpKernelTestUtils ${CPPUNIT_LIBRARIES})
INSTALL(TARGETS ParaMEDMEMTest DESTINATION ${MEDCOUPLING_INSTALL_LIBS})
TARGET_LINK_LIBRARIES(renumber renumbercpp)
INSTALL(TARGETS renumber DESTINATION ${MEDCOUPLING_INSTALL_BINS})
-ADD_LIBRARY(renumbercpp SHARED ${renumbercpp_SOURCES})
+ADD_LIBRARY(renumbercpp ${renumbercpp_SOURCES})
SET_TARGET_PROPERTIES(renumbercpp PROPERTIES COMPILE_FLAGS "${renumber_DEFINITIONS}")
TARGET_LINK_LIBRARIES(renumbercpp ${renumbercpp_LDFLAGS})
INSTALL(TARGETS renumbercpp DESTINATION ${MEDCOUPLING_INSTALL_LIBS})