Skip to content

Instantly share code, notes, and snippets.

@fbergmann
Created December 8, 2016 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fbergmann/5eb625a23cb17eb8463b8a6365885fd1 to your computer and use it in GitHub Desktop.
Save fbergmann/5eb625a23cb17eb8463b8a6365885fd1 to your computer and use it in GitHub Desktop.
# example script using the copasi cmake config file
# that is usually installed into lib/cmake
cmake_minimum_required(VERSION 2.8.11)
project (example_copasi_program)
# this searches for the libcopasi-static-config.cmake file
# that is exported by COPASI and will figure out all the
# dependent libraries
find_package(libCOPASISE-static CONFIG REQUIRED)
# add additional definitions here
#add_definitions(-D...)
# add additional include directories here (for example if you
# have not installed the COPASI dependencies into the same
# directory, or if you are using CMAKE < 2.8.12 and the include
# directories have not been passed on)
include_directories(~/copasi/include ~/copasi/include/copasi)
include_directories(~/Development/copasi-dependencies/bin/include)
# on windows this option has to match the option chosen to compile
# COPASI otherwise the library won't match
option(WITH_STATIC_RUNTIME "Compile using the static MSVC Runtime." OFF)
if(WITH_STATIC_RUNTIME)
foreach(flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
if(${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif(${flag_var} MATCHES "/MD")
endforeach(flag_var)
add_definitions( -D_MT)
endif(WITH_STATIC_RUNTIME)
add_executable(example_copasi_program main.cpp)
set_target_properties(example_copasi_program PROPERTIES OUTPUT_NAME example)
target_link_libraries(example_copasi_program libCOPASISE-static)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment