# Main # ==== # var to store the files set(specmicp_common_srcs "" CACHE INTERNAL "specmicp_common files" FORCE) set(specmicp_common_headers "" CACHE INTERNAL "specmicp_common headers" FORCE ) # macro to add to vars macro(add_to_main_srcs_list LIST_NAME) set(tmp "") foreach (src ${${LIST_NAME}}) list(APPEND tmp ${CMAKE_CURRENT_SOURCE_DIR}/${src}) endforeach(src) set(specmicp_common_srcs "${specmicp_common_srcs};${tmp}" CACHE INTERNAL "specmicp common files" FORCE) endmacro(add_to_main_srcs_list) macro(add_to_main_headers_list LIST_NAME) set( tmp "") foreach(header ${${LIST_NAME}}) LIST(APPEND tmp ${CMAKE_CURRENT_SOURCE_DIR}/${header}) endforeach(header) set(specmicp_common_headers "${specmicp_common_headers};${tmp}" CACHE INTERNAL "headers for specmicp common" FORCE) endmacro(add_to_main_headers_list) # set( specmicp_common_main_srcs dateandtime.cpp filesystem.cpp log.cpp moving_average.cpp openmp_support.cpp string_algorithms.cpp timer.cpp ) add_to_main_srcs_list( specmicp_common_main_srcs ) set( specmicp_common_main_headers cached_vector.hpp compat.hpp dateandtime.hpp filesystem.hpp log.hpp macros.hpp moving_average.hpp openmp_support.hpp options_handler.hpp perfs_handler.hpp pimpl_ptr.hpp range_iterator.hpp range_iterator.inl scope_guard.hpp string_algorithms.hpp timer.hpp types.hpp ) add_to_main_headers_list( specmicp_common_main_headers ) INSTALL(FILES ${headers} DESTINATION ${INCLUDE_INSTALL_DIR}/specmicp_common ) add_subdirectory(cli) add_subdirectory(eigen) add_subdirectory(io) add_subdirectory(micpsolver) add_subdirectory(odeint) add_subdirectory(physics) add_subdirectory(plugins) add_subdirectory(sparse_solvers) set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS config.h.in) add_custom_target(config_h SOURCES config.h.in) configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h ) # build library # ============= set_pgo_flag(${specmicp_common_srcs}) add_library(objspecmicp_common OBJECT ${specmicp_common_srcs} ${specmicp_common_headers} ) set_property(TARGET objspecmicp_common PROPERTY POSITION_INDEPENDENT_CODE 1) add_library(specmicp_common SHARED $) if (UNIX) set(specmicp_common_link_libraries dl) else() message(FATAL_ERROR "Plugin system only for POSIX at this time !") endif() if (HDF5_FOUND) set(specmicp_common_link_libraries "${HDF5_LIBRARIES};${specmicp_common_link_libraries}") endif() target_link_libraries(specmicp_common ${specmicp_common_link_libraries}) install(TARGETS specmicp_common LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR} ) # static libraries # ---------------- if(SPECMICP_BUILD_STATIC) add_library(specmicp_common_static STATIC $ ) install(TARGETS specmicp_common_static ARCHIVE DESTINATION ${STATIC_LIBRARY_INSTALL_DIR} ) else() add_library(specmicp_common_static EXCLUDE_FROM_ALL STATIC $ ) endif() target_link_libraries(specmicp_common_static ${specmicp_common_link_libraries}) set_target_properties(specmicp_common_static PROPERTIES OUTPUT_NAME specmicp_common)