Commit Graph

32 Commits

Author SHA1 Message Date
Brad King
2a37015319 Tests/FortranModules: Skip submodules with Cray Fortran compiler
Issue: #18925
2025-03-12 16:39:23 -04:00
Brad King
fa4ac78f4a Tests/FortranModules: Simplify check for submodules support 2025-03-12 16:37:54 -04:00
Brad King
7605228f5e codespell: Fix typos 2024-10-25 08:43:04 -04:00
Brad King
9e3b559b6a Tests: Update cmake_minimum_required versions to 3.10 2024-10-03 14:18:16 -04:00
Brad King
d704a3f818 Merge topic 'ninja-fortran-include'
36dc8d6d50 Ninja: Fix Fortran module deps in files INCLUDEd by preprocessed sources

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9351
2024-03-20 09:55:48 -04:00
Brad King
36dc8d6d50 Ninja: Fix Fortran module deps in files INCLUDEd by preprocessed sources
If a preprocessed source also uses the Fortran `INCLUDE` directive,
search the original source file's directory.

Fixes: #25792
2024-03-19 07:56:13 -04:00
Brad King
c2bd158712 Merge topic 'fortran-objects-as-sources-fix'
beb1393f8f Merge branch 'revert-exact-collation-depends-3.27' into fortran-objects-as-sources-fix
a033dce326 Makefiles: provide, but do not consume, "forward linked" target dirs
7cd0adab1b cmCommonTargetGenerator: use modules from linked object-referenced targets
1175f1c874 LinkItem: track `cmSourceFile` instances for external objects
d2fa56772f Ninja: support "forwarding" modules from other targets
ec1e589bec Ninja: Revert exact collation dependencies for 3.27
06df59b930 cmCommonTargetGenerator: return forward linked target dirs too
f8729ab366 cmLocalUnixMakefileGenerator3: handle object-referencing Fortran modules
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8989
2023-11-27 08:36:45 -05:00
Ben Boeckel
9d2769ecbd Tests/FortranModules: add test for TARGET_OBJECTS-as-linked-items module usage
Test module usage across a `$<TARGET_OBJECTS>`-as-linked-items use case.

See: #25425
2023-11-21 09:17:43 -05:00
Ben Boeckel
7c1e52be87 Tests/FortranModules: add test for TARGET_OBJECTS-as-sources module usage
Test module usage across a `$<TARGET_OBJECTS>`-as-sources use case.

See: #25425
2023-11-21 09:17:36 -05:00
Brad King
04c33e0990 Merge topic 'modules-depends-via-target-objects'
22da18b995 Fortran: Restore support for TARGET_OBJECTS providing modules
64d9240564 cmComputeLinkInformation: skip over linking to items for object purposes
035302b7e3 cmComputeLinkDepends: also copy the target from object link items
861876b936 Tests/ObjectLibrary: fix comment

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Merge-request: !8923
2023-10-31 09:12:30 -04:00
Ben Boeckel
22da18b995 Fortran: Restore support for TARGET_OBJECTS providing modules
Continue b665966933 (cmComputeLinkInformation: track OBJECT library
dependencies, 2023-07-22) which added explicitly listed `OBJECT`
libraries to the list of targets which the collator needs to consider.
Now also consider targets which provide objects directly to the target
via a `$<TARGET_OBJECT>` source lists.

Also add tests which use target objects directly and through an
`INTERFACE` library with target objects in its own sources.

Fixes: #25365
2023-10-30 10:06:12 -04:00
Brad King
264dcae5e4 Tests: Fix clang -Wstrict-prototypes warnings 2023-10-26 09:20:45 -04:00
Ben Boeckel
d870a47e23 Tests/FortranModules: add a test for iface Fortran sources
This tests that a library that doesn't compile Fortran sources but
provides one via `INTERFACE` sources works as intended.
2023-09-20 09:18:01 -04:00
Ben Boeckel
e3d511fb9c Tests/FortranModules: also test INTERFACE targets with Fortran sources 2023-09-20 09:16:59 -04:00
Ben Boeckel
978b68d3bb add_custom_target: Fix regression with Fortran sources
Since commit 74b1d6caf3 (cmComputeLinkInformation: compute link info for
module-using targets, 2023-09-05, v3.27.5~7^2) we accidentally try to
compute link information for custom targets if they have Fortran
sources.  For module dependencies, we only need to consider target types
that can compile.

Fixes: #25252
2023-09-20 09:14:58 -04:00
Ben Boeckel
619aca80ae Tests/FortranModules: add a test case for #25223 2023-09-18 19:58:49 -04:00
Ben Boeckel
45513c1a69 Tests/FortranModules: move issue 25112 fix from FortranOnly
It involves modules, so it belongs in the `FortranModules` test set.
2023-09-18 19:41:47 -04:00
Brad King
01d7860fdb Ninja,Makefile: Restore Fortran module scanning in static library cycle
Since

* commit eed295fd8a (cmGlobalNinjaGenerator: require that dependency info
                     files work, 2023-02-01, v3.26.0-rc1~1^2~1), and
* commit 13810dee17 (cmDependsFortran: require that dependency info files
                     work, 2023-02-01, v3.26.0-rc1~1^2),

the Ninja and Makefile generators' module dependency scanning requires
that scanning results from from linked targets is available before
scanning the current target.  In the case of a static library cycle,
we cannot expect this information from other static libraries in the
cycle.  Previously we supported cyclic cases at the cost of silently
ignoring missing information.

We already compute a global order of targets that respects all
`add_dependencies`, but may break `target_link_libraries` dependencies
that occur in a static library cycle.  Use this order to filter the
linked targets so we only expect scanning results to be available from
those targets that build before the current target.

This approach is sufficient to support module dependency scanning in
static library cycles as long as module dependencies do not cross
between two libraries in the same cycle.

Fixes: #24631
2023-03-24 15:57:52 -04:00
Ben Boeckel
a67da2ef66 Tests/FortranModules: add case for modules after "end interface X"
When there is an `end interface X` in a file, subsequent modules should
not be considered part of interface X.

Issue: #24203
2022-11-30 06:39:48 -05:00
Vitaly Mogulian
219a9b1e14 Fortran: Fix suprious dependencies with submodules
In commit 695f0d0d3a (cmFortranParser: Parse keywords as lexical tokens,
2016-09-05, v3.7.0-rc1~150^2) we created keyword-specific variants of
the original `USE WORD other EOSTMT` production, such as
`MODULE WORD other EOSTMT` and `INTERFACE WORD other EOSTMT`.  The same
pattern was used by more keyword-specific productions in commit b5ac8b8aa7
(Fortran: Add support for submodule syntax in dependency scanning,
2016-09-05, v3.7.0-rc1~73^2~1).

The postfix part (`other`) of several keyword-specific productions is
not needed to match Fortran syntax.  See the Fortran 2018 standard,
para.4.1.4/1 on p.28, para.14.2.1/2 on pp.293-294.  The postfix is
needed only for a case of operator 'use':

    use <module-name> [, only : <list-of-vars>]

The unnecessary postfix matching from the keyword-specific productions
such as module, submodule, and interface declarations can cause spurious
module dependencies to be detected, so remove it.

Extend the test suite with examples covering the previously-broken
cases.

Fixes: #18427
2022-08-09 09:11:30 -04:00
Brad King
7b0ab0439d Tests: Fix FortranModules test with Intel compiler on Windows
The test regularly fails updating the `vc*.pdb` compiler-generated
PDB file.  Add the `/Z7` flag as the compiler suggests for this.
2021-03-09 09:22:32 -05:00
Brad King
92785ed746 Tests: Enable Fortran submodule tests on XL compilers
Since commit b66bc6606e (Tests: Add Fortran submodule tests, 2016-09-22,
v3.7.0-rc1~55^2) we try a small test program to see if the Fortran
compiler supports submodules.  However, a typo in the test program
caused it to fail on XL with the error:

    1513-083 (E) Internal or module function id was not set within the function.

Fix the typo so that the check passes and enables the submodule tests
with XL compilers.
2020-02-28 10:37:11 -05:00
Kyle Edwards
5a8a9f7229 Ninja: Add multi-config variant
Co-Authored-by: vector-of-bool <vectorofbool@gmail.com>
2019-12-13 10:51:46 -05:00
Brad King
587ccffe74 Tests: Add symbols to FortranModules static libraries
When GNU `ar` creates an archive with no symbols it has only an
empty header but no string table.  On Solaris the OS-provided `ld`
fails in this case:

    ld: elf error: file libfoo.a: elf_getarsym

Update our test to actually provide symbols from its archives.
2019-09-26 10:31:44 -04:00
Brad King
ead16adfc8 Fortran: Fix module dependency scanning with upper-case SUBMODULE
The lexical token expression added by commit v3.7.0-rc1~73^2~1 (Fortran:
Add support for submodule syntax in dependency scanning, 2016-09-05)
has a typo and does not match upper-case `B` in `SUBMODULE`.  Fix it.

Fixes: #18595
2018-11-20 14:16:26 -05:00
Brad King
b1f95e5b14 Fortran: Extend submodule test with great-grandchild
Name the module using CamelCase to test lower-case file name conversion.
Also add coverage of existing "sibling" module.
2018-04-20 10:57:32 -04:00
Brad King
402735314e Fortran: Add support for submodule dependencies
Since commit v3.7.0-rc1~73^2~1 (Fortran: Add support for submodule
syntax in dependency scanning, 2016-09-05) we support parsing Fortran
sources that use submodule syntax, but it left addition of `.smod`
dependencies to future work.  Add it now.

The syntax

    submodule (module_name) submodule_name

means the current source requires `module_name.mod` and provides
`module_name@submodule_name.smod`.  The syntax

    submodule (module_name:submodule_name) nested_submodule_name

means the current source requires `module_name@submodule_name.smod`
provides `module_name@nested_submodule_name.smod`.

Fixes: #17017
2018-04-20 10:57:31 -04:00
Craig Scott
c267ea1c3e GENERATOR_IS_MULTI_CONFIG: Use for multi-config checks in Tests 2017-12-30 09:35:56 +11:00
luzpaz
777e87ae00 Fix trivial typos in text
Some are user facing.

Found using

    codespell -q 3 --skip="./Utilities" -I .cmake-whitelist.txt`

whereby the whitelist contained:

    ans
    dum
    helpfull
    emmited
    emmitted
    buil
    iff
    isnt
    nto
    ot
    pathes
    substract
    te
    todays
    upto
    whitespaces
2017-11-03 10:25:05 -04:00
Nils Gladitz
144cc6f1f9 Ninja: Add source location as include directory for preprocessed files
Fortran INCLUDE statements are not handled by the preprocessor.

Since the location of the preprocessed file is distinct from the
original source file explicitly add the source file's directory
as an include path in the actual compile step (not the preprocessing step)
so INCLUDE can find it.

Closes: #16332
2016-09-27 08:11:08 -04:00
Brad King
b66bc6606e Tests: Add Fortran submodule tests
Co-Author: Damian Rouson <damian@sourceryinstitute.org>
Issue: #16234
2016-09-23 08:51:06 -04:00
Brad King
eb8cd35684 Tests: Split Fortran module testing into separate FortranModules test
The main Fortran test is not granular enough.  Split some into another
test.
2016-09-22 14:52:01 -04:00