diff --git a/.travis.yml b/.travis.yml index ba17c87..4b20676 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,13 +22,15 @@ install: script: - > - FC=gfortran cmake -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} -B _build . + FC=gfortran cmake -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} + -DCMAKE_INSTALL_PREFIX=${PWD}/_install + -B _build . && cmake --build _build -- -j && cmake --install _build - > - CMAKE_PREFIX_PATH="${PWD}/_build/install:${CMAKE_PREFIX_PATH}" + CMAKE_PREFIX_PATH="${PWD}/_install:${CMAKE_PREFIX_PATH}" ./test/integration/cmake/runtest.sh _build_cmake - > - PKG_CONFIG_PATH="${PWD}/_build/install/lib/pkgconfig:${PKG_CONFIG_PATH}" + PKG_CONFIG_PATH="${PWD}/_install/lib/pkgconfig:${PKG_CONFIG_PATH}" FC=mpifort ./test/integration/pkgconfig/runtest.sh _build_pkgconfig diff --git a/CMakeLists.txt b/CMakeLists.txt index 44a313d..21836c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,14 @@ cmake_minimum_required(VERSION 3.16) -set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) +include(CMakePackageConfigHelpers) + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) +include(MpiFxUtils) + include(${CMAKE_CURRENT_SOURCE_DIR}/config.cmake) project(MpiFx VERSION 0.1 LANGUAGES Fortran) -include(MpiFxUtils) setup_build_type() # @@ -20,6 +23,8 @@ endif() # # Build instructions # +include(GNUInstallDirs) + add_subdirectory(lib) if(NOT BUILD_EXPORTED_TARGETS_ONLY) add_subdirectory(test) @@ -37,7 +42,6 @@ install(EXPORT mpifx-targets NAMESPACE MpiFx:: DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/mpifx") -include(CMakePackageConfigHelpers) configure_package_config_file( ${CMAKE_CURRENT_SOURCE_DIR}/utils/export/mpifx-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cmake/mpifx-config.cmake @@ -53,7 +57,6 @@ install( ${CMAKE_CURRENT_BINARY_DIR}/cmake/mpifx-config-version.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/mpifx) -include(GNUInstallDirs) GNUInstallDirs_get_absolute_install_dir(CMAKE_INSTALL_FULL_MODULEDIR CMAKE_INSTALL_MODULEDIR) get_pkgconfig_params(PKGCONFIG_REQUIRES PKGCONFIG_LIBS PKGCONFIG_LIBS_PRIVATE PKGCONFIG_C_FLAGS) diff --git a/README.rst b/README.rst index 484d74e..e40d884 100644 --- a/README.rst +++ b/README.rst @@ -23,7 +23,7 @@ Prerequisites * MPI-library and wrappers for your compiler -* `Fypp preprocessor `_. +* `Fypp preprocessor `_ Building and installing the library @@ -31,7 +31,7 @@ Building and installing the library The library can be built and installed with the usual CMake-workflow:: - FC=gfortran cmake -B _build + FC=gfortran cmake -B _build -DCMAKE_INSTALL_PREFIX=$HOME/opt/mpifx cmake --build _build cmake --install _build diff --git a/config.cmake b/config.cmake index 28d2389..c5e48e7 100644 --- a/config.cmake +++ b/config.cmake @@ -25,10 +25,10 @@ option(BUILD_SHARED_LIBS "Whether the library should be a shared one" FALSE) option(INSTALL_INCLUDE_FILES "Whether include / module files should be installed" TRUE) -set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE STRING +set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/_install" CACHE STRING "Directory to install the compiled code into") -set(CMAKE_INSTALL_LIBDIR "lib" CACHE PATH "Installation directory for libraries") +#set(CMAKE_INSTALL_LIBDIR "lib" CACHE PATH "Installation directory for libraries") set(CMAKE_INSTALL_INCLUDEDIR "include/mpifx" CACHE PATH "Installation directory for header and include files")