sethmmorton / cmake_fortran_template Goto Github PK
View Code? Open in Web Editor NEWA template directory structure for a Fortran project using CMake as the build system.
License: MIT License
A template directory structure for a Fortran project using CMake as the build system.
License: MIT License
Hi everyone,
I would like to know how to link OpenBLAS and LAPACK libraries to the fortran code.
Could someone give a CMakeLists.txt example of how to link those libraries?
Thank you
I tried the template code as is, and it worked fine for gfortran on Ubuntu 14.04
When i tried it with ifort, things were good too..
$ FC=ifort cmake ..
The Makefile was created and everything worked.
However, after flushing the build directory, I tried it with the PGI compiler to get
(FC=pgfortran cmake ..)
yosemite@yosemite-xeon:~/Dropbox/cmake_trials/build$ FC=pgfortran cmake ..
-- The Fortran compiler identification is PGI
-- Check for working Fortran compiler: /opt/pgi/linux86-64/15.7/bin/pgfortran
-- Check for working Fortran compiler: /opt/pgi/linux86-64/15.7/bin/pgfortran -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /opt/pgi/linux86-64/15.7/bin/pgfortran supports Fortran 90
-- Checking whether /opt/pgi/linux86-64/15.7/bin/pgfortran supports Fortran 90 -- yes
CMake Error at cmake/Modules/SetCompileFlag.cmake:109 (MESSAGE):
No compile flags were found
Call Stack (most recent call first):
cmake/Modules/SetFortranFlags.cmake:99 (SET_COMPILE_FLAG)
CMakeLists.txt:48 (INCLUDE)
-- Configuring incomplete, errors occurred!
I placed print statements in cmake/Modules/SetFortranFlags.cmake, and it seems like there is an issue with setting the first debug flag with the PGI compiler. Not sure what's going on under the hood, but thought it might be worth digging into.
The CMake style in this template is not the preferred style anymore. The CMake folks are advocating for "Modern CMake" (https://cliutils.gitlab.io/modern-cmake/, https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1), which from my understanding attempts to define everything in terms of targets and is less procedural.
I do not like providing examples to users that are using an obsolete style or do not use the best the language has to offer. I would like this template to be updated to use a more modern CMake style.
Unfortunately, I no longer use CMake (or Fortan for that matter) so I am not in a position to be updating the code to conform to best-practices. I am hoping some altruistic soul will stumble upon this issue and then create a Pull Request to make this template more modern.
This project is missing a license :(. Can you add it, so that it can be safely used in open source projects (e.g MIT).
I can't get LAPACK to work with the template. I enabled the
INCLUDE(${CMAKE_MODULE_PATH}/SetUpLAPACK.cmake)
line, and managed to get rid of the errors, so I think Cmake can find LAPACK. But I always get the error, that 'dgesv' (a lapack function) is an undefined reference. Do I have to enable any other settings or modify the compiler flags?
I'm using the MSYS2 LAPACK installation and it works fine from the command line.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.