From cb7cf713ae3209d6123a60c01b8e22d51ac69fc2 Mon Sep 17 00:00:00 2001 From: Neil Carlson Date: Mon, 13 Jan 2020 16:38:12 -0700 Subject: [PATCH] Update CMakeLists handling of .mod files --- CMakeLists.txt | 5 ----- src/CMakeLists.txt | 9 +++++++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ffd1c0def..b858ebd6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,11 +2,6 @@ cmake_minimum_required(VERSION 3.14.0) project(stdlib Fortran) enable_testing() -# this avoids stdlib and projects using stdlib from having to introspect stdlib's directory structure -# FIXME: this eventually needs to be handled more precisely, as this spills all .mod/.smod into one directory -# and thereby can clash if module/submodule names are the same in different parts of library -set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}) - # --- compiler options if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU) add_compile_options(-fimplicit-none) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 72b3d25cd..4a8d3fe03 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,6 +9,14 @@ set(SRC add_library(fortran_stdlib ${SRC}) +set(LIB_MOD_DIR ${CMAKE_CURRENT_BINARY_DIR}/mod_files/) +set_target_properties(fortran_stdlib PROPERTIES + Fortran_MODULE_DIRECTORY ${LIB_MOD_DIR}) +target_include_directories(fortran_stdlib PUBLIC + $ + $ +) + if(f18errorstop) target_sources(fortran_stdlib PRIVATE f18estop.f90) else() @@ -22,3 +30,4 @@ install(TARGETS fortran_stdlib ARCHIVE DESTINATION lib LIBRARY DESTINATION lib ) +install(DIRECTORY ${LIB_MOD_DIR} DESTINATION include)