3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-23 04:43:42 +01:00

[cmake] Improve cmake status messages if we are a subproject

This commit is contained in:
Nils Wentzell 2020-04-22 15:05:24 -04:00
parent b9d934554c
commit ed5812988f
2 changed files with 20 additions and 16 deletions

View File

@ -50,7 +50,9 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR (NOT IS_ABSOLUTE ${CMAKE_INSTA
set(CMAKE_INSTALL_PREFIX ${TRIQS_ROOT} CACHE PATH "default install path" FORCE) set(CMAKE_INSTALL_PREFIX ${TRIQS_ROOT} CACHE PATH "default install path" FORCE)
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT FALSE) set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT FALSE)
endif() endif()
if(NOT IS_SUBPROJECT)
message(STATUS "-------- CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX} --------") message(STATUS "-------- CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX} --------")
endif()
# ############ # ############
# Dependencies # Dependencies
@ -63,7 +65,9 @@ add_subdirectory(deps)
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Type of build" FORCE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Type of build" FORCE)
endif() endif()
if(NOT IS_SUBPROJECT)
message(STATUS "-------- BUILD-TYPE: ${CMAKE_BUILD_TYPE} --------") message(STATUS "-------- BUILD-TYPE: ${CMAKE_BUILD_TYPE} --------")
endif()
# Export the list of compile-commands into compile_commands.json # Export the list of compile-commands into compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
@ -77,8 +81,6 @@ add_compile_options(
# Create an Interface target for compiler warnings # Create an Interface target for compiler warnings
if(NOT TARGET project_warnings) if(NOT TARGET project_warnings)
add_library(project_warnings INTERFACE) add_library(project_warnings INTERFACE)
endif()
install(TARGETS project_warnings EXPORT app4triqs-targets)
target_compile_options(project_warnings target_compile_options(project_warnings
INTERFACE INTERFACE
-Wall -Wall
@ -92,6 +94,8 @@ target_compile_options(project_warnings
$<$<CXX_COMPILER_ID:AppleClang>:-Wshadow> $<$<CXX_COMPILER_ID:AppleClang>:-Wshadow>
$<$<CXX_COMPILER_ID:AppleClang>:-Wno-gcc-compat> $<$<CXX_COMPILER_ID:AppleClang>:-Wno-gcc-compat>
) )
endif()
install(TARGETS project_warnings EXPORT app4triqs-targets)
# ############# # #############
# Build Project # Build Project

View File

@ -1,6 +1,6 @@
add_subdirectory(cmake) add_subdirectory(cmake)
if(NOT CMAKE_INSTALL_PREFIX STREQUAL TRIQS_ROOT) if(NOT CMAKE_INSTALL_PREFIX STREQUAL TRIQS_ROOT AND NOT IS_SUBPROJECT)
configure_file(app4triqs.modulefile.in app4triqs.modulefile @ONLY) configure_file(app4triqs.modulefile.in app4triqs.modulefile @ONLY)
configure_file(app4triqsvars.sh.in app4triqsvars.sh @ONLY) configure_file(app4triqsvars.sh.in app4triqsvars.sh @ONLY)