-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cmake/Makefile for ttb #29
Comments
Hi, unfortunately I have absolutely no experience on that. Could you point me to some links or give a small example please? |
Ok, fair enough :)
I have attached a Cmake file doing a static library for TTB. I needed to
remove "ttb/" in the various *include* statements in ttb_libary.f in order
to make it work.
# CMake project file for TTB
# PROJECT
cmake_minimum_required (VERSION 2.6)
project (TTB)
enable_language (Fortran)
# Additional variables
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake-modules/")
# Compilers flag
set (CMAKE_Fortran_FLAGS "-O3 -ffast-math")
# module locations
set(CMAKE_Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/mod")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
# Library name
set(TARGET ttb)
# Collect files
file(GLOB src "ttb/ttb_library.f")
set_source_files_properties(${src} PROPERTIES LANGUAGE Fortran)
# Add the library
add_library(${TARGET} ${src})
|
PS:
if you want the lib to be shared, just do add_library(${TARGET} SHARED
${src}) instead.
Thank you for your contribution!
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @adtzlr,
Thanks for this, it is going to be very useful!
In order to make your library easier to interface with existing codes, would you consider to do a CMakeLists.txt or a Makefile?
The text was updated successfully, but these errors were encountered: