diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/CPackComponentsDEB/MyLibCPackConfig-components-description1.cmake.in | 6 | ||||
-rw-r--r-- | Tests/CPackComponentsDEB/MyLibCPackConfig-components-description2.cmake.in | 6 | ||||
-rw-r--r-- | Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake | 4 | ||||
-rw-r--r-- | Tests/CPackComponentsDEB/pkg_description.txt | 1 | ||||
-rw-r--r-- | Tests/FortranModules/CMakeLists.txt | 31 | ||||
-rw-r--r-- | Tests/FortranModules/Submodules/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/FortranModules/Submodules/main.f90 | 5 | ||||
-rw-r--r-- | Tests/FortranModules/Submodules/provide.f90 | 57 | ||||
-rw-r--r-- | Tests/SwiftOnly/CMakeLists.txt | 4 |
10 files changed, 106 insertions, 10 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 235e38a..3681843 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -3109,6 +3109,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --build-project FortranModules --build-options ${build_options} -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM} + -DCMake_TEST_Fortran_SUBMODULES:BOOL=${CMake_TEST_Fortran_SUBMODULES} ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/FortranModules") endif() diff --git a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description1.cmake.in b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description1.cmake.in index 6c5a655..74d816c 100644 --- a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description1.cmake.in +++ b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description1.cmake.in @@ -15,8 +15,8 @@ set(CPACK_COMPONENTS_IGNORE_GROUPS 1) #set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1) # overriding previous descriptions -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "main description") -set(CPACK_DEBIAN_APPLICATIONS_PACKAGE_DESCRIPTION "applications_description") -set(CPACK_COMPONENT_HEADERS_DESCRIPTION "headers_description") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "main description") +set(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION "applications_description") +set(CPACK_COMPONENT_HEADERS_DESCRIPTION "headers_description") # libraries does not have any description and should inherit from CPACK_PACKAGE_DESCRIPTION_SUMMARY unset(CPACK_COMPONENT_LIBRARIES_DESCRIPTION) diff --git a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description2.cmake.in b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description2.cmake.in index 92226d8..cda79bc 100644 --- a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description2.cmake.in +++ b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description2.cmake.in @@ -17,12 +17,10 @@ set(CPACK_COMPONENTS_IGNORE_GROUPS 1) # overriding previous descriptions set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "main description 2") -# and override CPACK_PACKAGE_DESCRIPTION_SUMMARY because of precedence -set(CPACK_PACKAGE_DESCRIPTION_FILE - "@CPackComponentsDEB_SOURCE_DIR@/pkg_description.txt") - # Components do not have any description unset(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION) unset(CPACK_COMPONENT_HEADERS_DESCRIPTION) +unset(CPACK_COMPONENT_LIBRARIES_DESCRIPTION) + set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "library description") diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake index 7b94ca0..35ca74c 100644 --- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake +++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake @@ -55,12 +55,12 @@ if(DPKGDEB_EXECUTABLE) message(STATUS "package='${dpkg_package_name}', description='${dpkg_description}'") if("${dpkg_package_name}" STREQUAL "mylib-applications") - if(NOT "${dpkg_description}" STREQUAL "Debian package description file") + if(NOT "${dpkg_description}" STREQUAL "main description 2") set(dpkgdeb_output_errors_all ${dpkgdeb_output_errors_all} "dpkg-deb: ${_f}: Incorrect description for package ${dpkg_package_name}: ${dpkg_description} != applications_description") endif() elseif("${dpkg_package_name}" STREQUAL "mylib-headers") - if(NOT "${dpkg_description}" STREQUAL "Debian package description file") + if(NOT "${dpkg_description}" STREQUAL "main description 2") set(dpkgdeb_output_errors_all ${dpkgdeb_output_errors_all} "dpkg-deb: ${_f}: Incorrect description for package ${dpkg_package_name}: ${dpkg_description} != headers_description") endif() diff --git a/Tests/CPackComponentsDEB/pkg_description.txt b/Tests/CPackComponentsDEB/pkg_description.txt deleted file mode 100644 index 99f8f9b..0000000 --- a/Tests/CPackComponentsDEB/pkg_description.txt +++ /dev/null @@ -1 +0,0 @@ -Debian package description file diff --git a/Tests/FortranModules/CMakeLists.txt b/Tests/FortranModules/CMakeLists.txt index b406df3..ff12771 100644 --- a/Tests/FortranModules/CMakeLists.txt +++ b/Tests/FortranModules/CMakeLists.txt @@ -5,6 +5,33 @@ if(NOT DEFINED CMake_TEST_NESTED_MAKE_PROGRAM AND NOT CMAKE_GENERATOR MATCHES "V set(CMake_TEST_NESTED_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}") endif() +if("x${CMake_TEST_Fortran_SUBMODULES}" STREQUAL "x" + AND NOT CMAKE_VERSION VERSION_LESS 3.6.20160923 # for CheckFortranSourceCompiles SRC_EXT + ) + include(CheckFortranSourceCompiles) + CHECK_Fortran_SOURCE_COMPILES([[ +module parent + interface + module function id(x) + real, intent(in) :: x + real :: id + end function id + end interface +end module parent +submodule ( parent ) child +contains + module procedure id + f = x + end procedure id +end submodule child +program main +end program +]] HAVE_SUBMODULES SRC_EXT F90) + set(CMake_TEST_Fortran_SUBMODULES ${HAVE_SUBMODULES}) +elseif(CMake_TEST_Fortran_SUBMODULES) + message(STATUS "Enabling Fortran submodule tests by explicit request.") +endif() + add_executable(test_module test_module_main.f90 test_module_implementation.f90 @@ -76,3 +103,7 @@ endif() add_subdirectory(Library) add_subdirectory(Subdir) add_subdirectory(Executable) + +if(CMake_TEST_Fortran_SUBMODULES) + add_subdirectory(Submodules) +endif() diff --git a/Tests/FortranModules/Submodules/CMakeLists.txt b/Tests/FortranModules/Submodules/CMakeLists.txt new file mode 100644 index 0000000..bf0152f --- /dev/null +++ b/Tests/FortranModules/Submodules/CMakeLists.txt @@ -0,0 +1 @@ +add_executable(submod main.f90 provide.f90) diff --git a/Tests/FortranModules/Submodules/main.f90 b/Tests/FortranModules/Submodules/main.f90 new file mode 100644 index 0000000..3c750ce --- /dev/null +++ b/Tests/FortranModules/Submodules/main.f90 @@ -0,0 +1,5 @@ +program main + use parent, only : child_function,grandchild_subroutine + implicit none + if (child_function()) call grandchild_subroutine +end program diff --git a/Tests/FortranModules/Submodules/provide.f90 b/Tests/FortranModules/Submodules/provide.f90 new file mode 100644 index 0000000..0ad216a --- /dev/null +++ b/Tests/FortranModules/Submodules/provide.f90 @@ -0,0 +1,57 @@ +! The program units in this file consist of a +! module/submodule tree represented by the following +! graph: +! +! parent +! | +! / \ +! / \ +! child sibling +! | +! grandchild +! +! where the parent node is a module and all other +! nodes are submodules. + +module parent + implicit none + + interface + + ! Test Fortran 2008 "module function" syntax + module function child_function() result(child_stuff) + logical :: child_stuff + end function + + ! Test Fortran 2008 "module subroutine" syntax + module subroutine grandchild_subroutine() + end subroutine + + end interface + +end module parent + +! Test the notation for a 1st-generation direct +! descendant of a parent module +submodule ( parent ) child + implicit none +contains + module function child_function() result(child_stuff) + logical :: child_stuff + child_stuff=.true. + end function +end submodule child + +! Empty submodule for checking disambiguation of +! nodes at the same vertical level in the tree +submodule ( parent ) sibling +end submodule sibling + +! Test the notation for an Nth-generation descendant +! for N>1, which necessitates the colon. +submodule ( parent : child ) grandchild +contains + module subroutine grandchild_subroutine() + print *,"Test passed." + end subroutine +end submodule grandchild diff --git a/Tests/SwiftOnly/CMakeLists.txt b/Tests/SwiftOnly/CMakeLists.txt index 5cb9739..cf4463c 100644 --- a/Tests/SwiftOnly/CMakeLists.txt +++ b/Tests/SwiftOnly/CMakeLists.txt @@ -1,4 +1,8 @@ cmake_minimum_required(VERSION 3.3) project(SwiftOnly Swift) +if(NOT XCODE_VERSION VERSION_LESS 8.0) + set(CMAKE_Swift_LANGUAGE_VERSION 3.0) +endif() + add_executable(SwiftOnly main.swift) |