1
1
cmake_minimum_required (VERSION 3.10)
2
2
3
- cmake_policy (VERSION 3.10...3.12)
4
-
3
+ cmake_policy (VERSION 3.10...3.14)
4
+
5
+ set (CMAKE_SKIP_RPATH ON
6
+ CACHE BOOL "Don't add a build-dir rpath" )
7
+ set (CMAKE_BUILD_WITH_INSTALL_RPATH ON
8
+ CACHE BOOL "Build using the install rpath" )
9
+ set (CMAKE_BUILD_RPATH_USE_ORIGIN ON
10
+ CACHE BOOL "Use relative rpaths" )
5
11
# Set the type/configuration of build to perform
6
12
set ( CMAKE_CONFIGURATION_TYPES "Debug" "Release" "MinSizeRel" "RelWithDebInfo" "CodeCoverage" )
7
13
set ( CMAKE_BUILD_TYPE "Release"
@@ -88,6 +94,11 @@ string(REGEX REPLACE "-rc[0-9]+$"
88
94
89
95
project (opencoarrays VERSION "${OPENCOARRAYS_CMAKE_PROJECT_VERSION} " LANGUAGES C Fortran)
90
96
97
+ if (DEFINED CMAKE_BUILD_TYPE AND "${CMAKE_BUILD_TYPE} " MATCHES "[Rr][Ee][Ll]" )
98
+ set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fno-working-directory" )
99
+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-working-directory" )
100
+ endif ()
101
+
91
102
message ( STATUS "Building OpenCoarrays version: ${full_git_describe} " )
92
103
set (OpenCoarrays_dist_string "OpenCoarrays-${full_git_describe} " )
93
104
message ( STATUS "Building for target architecture: ${CMAKE_SYSTEM_PROCESSOR} " )
@@ -211,7 +222,7 @@ endif()
211
222
212
223
if (gfortran_compiler)
213
224
set (OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} )
214
- set (CMAKE_REQUIRED_FLAGS $<$<COMPILE_LANGUAGE:Fortran>:" -fcoarray=single -ffree-form" >)
225
+ set (CMAKE_REQUIRED_FLAGS $<$<COMPILE_LANGUAGE:Fortran>:-fcoarray=single -ffree-form>)
215
226
endif ()
216
227
include (CheckFortranSourceCompiles)
217
228
CHECK_Fortran_SOURCE_COMPILES("
@@ -483,7 +494,6 @@ set(CMAKE_C_COMPILE_FLAGS "${CMAKE_C_COMPILE_FLAGS} ${MPI_C_COMPILE_FLAGS}")
483
494
set (CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} ${MPI_C_LINK_FLAGS} " )
484
495
set (CMAKE_Fortran_COMPILE_FLAGS "${CMAKE_Fortran_COMPILE_FLAGS} ${MPI_Fortran_COMPILE_FLAGS} " )
485
496
set (CMAKE_Fortran_LINK_FLAGS "${CMAKE_Fortran_LINK_FLAGS} ${MPI_Fortran_LINK_FLAGS} " )
486
- include_directories (BEFORE ${MPI_C_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH} )
487
497
488
498
#---------------------------------------------------
489
499
# Use standardized GNU install directory conventions
@@ -527,8 +537,9 @@ function(caf_compile_executable target main_depend)
527
537
-o "${CMAKE_RUNTIME_OUTPUT_DIRECTORY} /${target} "
528
538
"${CMAKE_CURRENT_SOURCE_DIR} /${main_depend} "
529
539
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY} /libopencoarrays_test_utilities.a"
540
+ "${CMAKE_LIBRARY_OUTPUT_DIRECTORY} /libopencoarrays_mod.a"
530
541
${ARGN}
531
- DEPENDS "${main_depend} " ${ARGN} caf_mpi_static opencoarrays_test_utilities
542
+ DEPENDS "${main_depend} " ${ARGN} caf_mpi_static opencoarrays_test_utilities opencoarrays_mod
532
543
VERBATIM
533
544
)
534
545
add_custom_target ("build_${target} " ALL
@@ -591,8 +602,6 @@ define_property(TARGET
591
602
#-------------------------------
592
603
# Recurse into the src directory
593
604
#-------------------------------
594
- include_directories (BEFORE ${CMAKE_CURRENT_SOURCE_DIR} /src)
595
-
596
605
add_subdirectory (src)
597
606
598
607
#-----------------------------------------------------
@@ -621,10 +630,6 @@ install(
621
630
"${CMAKE_INSTALL_LIBDIR} /cmake/opencoarrays"
622
631
)
623
632
624
- add_library (OpenCoarrays INTERFACE )
625
- target_compile_options (OpenCoarrays INTERFACE $<$<COMPILE_LANGUAGE:Fortran>:"-fcoarray=lib" )
626
- target_link_libraries (OpenCoarrays INTERFACE caf_mpi)
627
-
628
633
#------------------------------------------
629
634
# Add portable unistall command to makefile
630
635
#------------------------------------------
@@ -639,6 +644,14 @@ add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure)
639
644
# See JSON-Fortran's CMakeLists.txt file to find out how to get the check target to depend
640
645
# on the test executables
641
646
647
+ #------------------------------------
648
+ # Add command to hash installed files
649
+ #------------------------------------
650
+ configure_file ( "${CMAKE_SOURCE_DIR} /cmake/hash-installed.cmake.in" "${CMAKE_BINARY_DIR} /hash-installed.cmake"
651
+ @ONLY)
652
+ add_custom_target ( hash_installed
653
+ COMMAND ${CMAKE_COMMAND} -P "${CMAKE_BINARY_DIR} /hash-installed.cmake" )
654
+
642
655
#---------------------------------------------------------------------------------------
643
656
# Define macro for adding CAF tests, and ensuring proper flags are passed to MPI runtime
644
657
#---------------------------------------------------------------------------------------
@@ -916,3 +929,7 @@ foreach(SCRIPT ${TRAVIS_SCRIPTS})
916
929
lint_script("${CMAKE_SOURCE_DIR} /developer-scripts/travis" ${SCRIPT} )
917
930
endif ()
918
931
endforeach ()
932
+
933
+ install (FILES "${CMAKE_BINARY_DIR} /sha256_install_manifest.txt"
934
+ DESTINATION "${CMAKE_INSTALL_DATADIR} /opencoarrays"
935
+ OPTIONAL )
0 commit comments