Open AliE89 opened 1 year ago
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_minimum_required (VERSION 2.6) project (TTB) enable_language (Fortran)
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake-modules/")
set (CMAKE_Fortran_FLAGS "-O3 -ffast-math")
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")
set(TARGET ttb)
file(GLOB src "ttb/ttb_library.f") set_source_files_properties(${src} PROPERTIES LANGUAGE Fortran)
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!
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?