diff --git a/CMakeLists.txt b/CMakeLists.txt index a7bf11bd3..edc559db4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,9 @@ message( STATUS ============================================================ ") +message( STATUS "Running with CMake from: ${CMAKE_COMMAND}" ) +message( STATUS "Current source dir (for OpenCoarrays): ${CMAKE_CURRENT_SOURCE_DIR}") + # Add option and check environment to determine if developer tests should be run if($ENV{OPENCOARRAYS_DEVELOPER}) option(CAF_RUN_DEVELOPER_TESTS "Run tests intended only for developers" ON) @@ -80,8 +83,10 @@ string(REGEX REPLACE "-rc[0-9]+$" "${OpenCoarraysVersion}") project(opencoarrays VERSION "${OPENCOARRAYS_CMAKE_PROJECT_VERSION}" LANGUAGES C Fortran) + message( STATUS "Building OpenCoarrays version: ${full_git_describe}" ) set(OpenCoarrays_dist_string "OpenCoarrays-${full_git_describe}") +message( STATUS "Building for target architecture: ${CMAKE_SYSTEM_PROCESSOR}" ) #Print an error message on an attempt to build inside the source directory tree: if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") @@ -838,7 +843,9 @@ include(cmake/AddInstallationScriptTest.cmake ) add_installation_script_test(installation-scripts.sh src/tests/installation/) # Test ISO_Fortran_binding library -if( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" ) +if( (( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" ) AND ( "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" )) + OR ( CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER} ) ) + # See https://github.com/sourceryinstitute/OpenCoarrays/issues/523#issuecomment-401613209 add_test(NAME ISO_Fortran_binding_tests COMMAND "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ISO_Fortran_binding_tests") endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 23c23c5f0..3708bc4ee 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,9 +1,4 @@ -set(directories_to_build mpi tests) - -if( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" ) - LIST( APPEND directories_to_build iso-fortran-binding ) -endif() - +set(directories_to_build mpi tests iso-fortran-binding) foreach(directory ${directories_to_build}) add_subdirectory(${directory}) endforeach() diff --git a/src/mpi/CMakeLists.txt b/src/mpi/CMakeLists.txt index 488cf2f82..1b0210bbb 100644 --- a/src/mpi/CMakeLists.txt +++ b/src/mpi/CMakeLists.txt @@ -21,7 +21,7 @@ if (mpi_version_out MATCHES "[Oo]pen[ -][Mm][Pp][Ii]") message( STATUS "OpenMPI detected") set ( openmpi true PARENT_SCOPE) # Write out a host file because OMPI's mpiexec is dumb - file(APPEND ${CMAKE_BINARY_DIR}/hostfile "${HOST_NAME} slots=${N_CPU}\n") + file(WRITE ${CMAKE_BINARY_DIR}/hostfile "${HOST_NAME} slots=${N_CPU}\n") endif () if("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU") diff --git a/src/tests/unit/CMakeLists.txt b/src/tests/unit/CMakeLists.txt index 7e7ef68ac..67d6d37e4 100644 --- a/src/tests/unit/CMakeLists.txt +++ b/src/tests/unit/CMakeLists.txt @@ -5,7 +5,6 @@ if (${opencoarrays_aware_compiler}) add_subdirectory(collectives) add_subdirectory(sync) add_subdirectory(events) - add_subdirectory(iso-fortran-binding) if (gfortran_compiler) if(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7) add_subdirectory(fail_images) @@ -17,3 +16,7 @@ if (${opencoarrays_aware_compiler}) else() add_subdirectory(extensions) endif() +if( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR + (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER})) + add_subdirectory(iso-fortran-binding) +endif()