simplifying the build of static or shared libraries
@@ -129,16 +129,13 @@ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DROSS_OPTION_LIST='\"${OPTIONS}\"'")
# Generate Library
ADD_LIBRARY(ROSS_obj OBJECT ${ross_srcs})
-ADD_LIBRARY(ROSS SHARED $<TARGET_OBJECTS:ROSS_obj>)
+OPTION(ROSS_BUILD_SHARED_LIBS "Build shared libraries instead of static" OFF)
+SET(BUILD_SHARED_LIBS ${ROSS_BUILD_SHARED_LIBS})
+ADD_LIBRARY(ROSS $<TARGET_OBJECTS:ROSS_obj>)
SET_TARGET_PROPERTIES(ROSS PROPERTIES OUTPUT_NAME ROSS)
TARGET_LINK_LIBRARIES(ROSS ${ROSS_EXTERNAL_LIBS})
TARGET_INCLUDE_DIRECTORIES(ROSS INTERFACE ${MPI_C_INCLUDE_PATH})
-ADD_LIBRARY(ROSS_static STATIC $<TARGET_OBJECTS:ROSS_obj>)
-SET_TARGET_PROPERTIES(ROSS_static PROPERTIES OUTPUT_NAME ROSS)
-TARGET_LINK_LIBRARIES(ROSS_static ${ROSS_EXTERNAL_LIBS})
-TARGET_INCLUDE_DIRECTORIES(ROSS_static INTERFACE ${MPI_C_INCLUDE_PATH})
-
if (COVERALLS)
set(COVERAGE_SRCS ${ross_srcs})
# Don't check coverage on lz4
@@ -171,7 +168,7 @@ SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/ross.pc PROPERTIES GENER
INSTALL(FILES ${ROSS_BINARY_DIR}/ross-config DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
INSTALL(FILES ${ROSS_BINARY_DIR}/config.h DESTINATION include)
INSTALL(DIRECTORY ${ROSS_SOURCE_DIR}/ DESTINATION include FILES_MATCHING PATTERN "*.h")
-INSTALL(TARGETS ROSS_static ROSS EXPORT ROSS-targets DESTINATION lib)
+INSTALL(TARGETS ROSS EXPORT ROSS-targets DESTINATION lib)
INSTALL(EXPORT ROSS-targets DESTINATION lib)
INSTALL(FILES ROSSConfig.cmake DESTINATION lib)
INSTALL(FILES ${ROSS_BINARY_DIR}/ross.pc DESTINATION lib/pkgconfig)
