CMakeLists.txt 815 Bytes
cmake_minimum_required(VERSION 2.6)

PROJECT(cainlib CXX Fortran)

add_definitions( -DLINUX )

set(CMAKE_BUILD_TYPE Release)

set(CMAKE_CXX_FLAGS "-O3 -fPIC -fno-align-commons -fbounds-check -fbacktrace -ffixed-form")

if(NOT DEFINED ENV{CAIN_COEF_DIR})
    set(CAIN_COEF_DIR "${CMAKE_SOURCE_DIR}/src/")
else()
    set(CAIN_COEF_DIR "$ENV{CAIN_COEF_DIR}")
endif()

configure_file (
 "${CMAKE_SOURCE_DIR}/src/cain.f90.in"
 "${CMAKE_SOURCE_DIR}/src/cain.f90"
)

file(
		GLOB
		source_files
		src/*.f90
)

add_library(cainlib SHARED ${source_files})

SET_TARGET_PROPERTIES(cainlib PROPERTIES LINKER_LANGUAGE CXX)

install (TARGETS cainlib DESTINATION lib)
install (FILES src/include/cainlib.hh DESTINATION include)
if(DEFINED ENV{CAIN_COEF_DIR})
    install (FILES src/FSU_mars90 DESTINATION ${CAIN_COEF_DIR})
endif()