diff options
author | Brad King <brad.king@kitware.com> | 2022-02-25 13:07:22 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-02-25 13:07:35 (GMT) |
commit | 07a7772968a17e804fc7c450a0a3a00a7203410d (patch) | |
tree | 08b0f349cb961926252f7fe58c9d4fa551cc9555 /Tests | |
parent | 7d110c25ed2a92dcda5407ea9686b0f60b8fe7af (diff) | |
parent | 6b4885b58b8204153919d068363f5fe42fef6ec4 (diff) | |
download | CMake-07a7772968a17e804fc7c450a0a3a00a7203410d.zip CMake-07a7772968a17e804fc7c450a0a3a00a7203410d.tar.gz CMake-07a7772968a17e804fc7c450a0a3a00a7203410d.tar.bz2 |
Merge topic 'ninja-gfortran-preprocess' into release-3.23
6b4885b58b Ninja: Avoid preprocessing twice with explicit Fortran_PREPROCESS
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7008
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/FortranOnly/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/FortranOnly/preprocess2.f | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt index ee47da4..b07c214 100644 --- a/Tests/FortranOnly/CMakeLists.txt +++ b/Tests/FortranOnly/CMakeLists.txt @@ -129,6 +129,12 @@ if(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON AND add_executable(preprocess_target preprocess2.f) set_property(TARGET preprocess_target PROPERTY Fortran_PREPROCESS ON) + if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") + # gfortran might report spurious warnings if we include the + # preprocessing flags at the compilation stage + target_compile_options(preprocess_target PRIVATE -Wall -Werror) + endif() + # Test that we can preprocess a single source file add_executable(preprocess_source preprocess3.f) set_property(SOURCE preprocess3.f PROPERTY Fortran_PREPROCESS ON) diff --git a/Tests/FortranOnly/preprocess2.f b/Tests/FortranOnly/preprocess2.f index 6595d62..3b332c4 100644 --- a/Tests/FortranOnly/preprocess2.f +++ b/Tests/FortranOnly/preprocess2.f @@ -1,4 +1,6 @@ #define int INTEGER + ! This single unmatched quote ' should not cause an error during compilation PROGRAM PREPRO - int f + int f = 1 + PRINT*, f END |