Skip to content

sync with the latest version#1

Merged
fangq merged 19 commits intofangq:masterfrom
josephalevin:master
May 8, 2020
Merged

sync with the latest version#1
fangq merged 19 commits intofangq:masterfrom
josephalevin:master

Conversation

@fangq
Copy link
Copy Markdown
Owner

@fangq fangq commented May 8, 2020

No description provided.

acroucher and others added 19 commits January 30, 2019 14:46
This is the CMakeLists.txt and supporting file that allow using CMake to
build FSON and install to the user's CMake registry.  After building and
installing, (with a possible CMAKE_INSTALL_PREFIX=...), the user can
simply add

    find_package(FSON)
    target_link_libraries(mytarget FSON::FSON)

and everything will Just Work™.

Note, this only deals with building the library and does not yet build
the tests.

[FetchContent]: https://cmake.org/cmake/help/latest/module/FetchContent.html
After taking some more time to review the Meson build, I deduced how to
include the tests with the CMake build.  We have to add [zofu][zofu],
and we need to tell CMake how to build it.  The building of zofu could
be replaced by the appropriate CMake import details if it gets a CMake
build.

[zofu]: https://github.com/acroucher/zofu
I tested with CMake 2.8 but it does not support the features necessary
to handle configuring and installing as implemented.  However, CMake 2
is an outdated version and the general recommendation is to use CMake 3.
The way the tests are written does not clearly indicate the generation
of the source depends on the zofu-driver.  This information can probably
be indicated in a clearer way, but my suspicion is this would require
zofu to use CMake.  Or it might not.
Testing on RHEL 6 with GFortran 4.7.3 revealed that old GFortrans cannot
build zofu.  As such, we need a means to disable building the tests.
However, we want to default to building the tests.

To toggle test building on or off use

    cmake3 -DENABLE_TESTS:BOOL=ON ..
I was able to give an overview of Make (probably not really recommended)
and CMake.  I primarily wanted to incorporate notes on disabling the
tests under CMake for use with GFortran 4.7.  I do not have enough
knowledge about Meson to explain that method other than saying "run
meson".
We may need to incorporate FSON into another package that also wants to
use ENABLE_TESTS.  It's safer to "scope" the option.
Older version of CMake (at least as old as 3.6.1) did not have support
for Fortran_COMPILER_ID generator expressions.  The common work around
was to do string comparisons.
Fortran modules are compiler specific.  This means we should install the
modules under a directory tagged with the compiler.  CMake can handle
tracking the transient dependencies so this should not cause problems if
two different compilers are required.
@fangq fangq merged commit 334e56a into fangq:master May 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants