From 92b9ba5aa357701909464eab375ce22867ff14f2 Mon Sep 17 00:00:00 2001 From: Thomas Bolemann Date: Tue, 18 Oct 2016 16:45:08 +0200 Subject: [PATCH] Bugfix: Override definition of install path (bin folder) has to be performed after the project definition, so make install wont always target /usr/local --- CMakeLists.txt | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8cf02a5..137765b 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,18 +39,6 @@ ELSE() ENDIF() ENDIF() -# ========================================================================= -# Project definitions and output paths -# ========================================================================= -SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) -SET(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include) -SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) -SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) - -IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - SET(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}" CACHE PATH "Prefix prepended to install directories" FORCE) -ENDIF() - # ========================================================================= # Detect machine environements # ========================================================================= @@ -69,12 +57,25 @@ IF (ONHORNET GREATER -1) ENDIF() # ========================================================================= -# Options +# Project definitions and output paths # ========================================================================= - PROJECT(Hopr) ENABLE_LANGUAGE(C Fortran) +SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) +SET(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include) +SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) +SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) + +# Set custom install dir (needs to be done after project has been defined!) +IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + SET(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}" CACHE PATH "Prefix prepended to install directories" FORCE) +ENDIF() + +# ========================================================================= +# Options +# ========================================================================= + MACRO(SUBDIRLIST result curdir) FILE(GLOB children RELATIVE ${curdir} ${curdir}/*) SET(dirlist "")