Skip to content

Commit

Permalink
improve main CMakeLists.txt
Browse files Browse the repository at this point in the history
* set UREACT_PEDANTIC and UREACT_WERROR by default when ureact is a master project
* hide ureact's messages is ureact is not a master project
* remove CMake version output in case ureact is a master project
  • Loading branch information
YarikTH committed Sep 10, 2023
1 parent 45a0c85 commit cc7b04e
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,27 @@ if(NOT DEFINED UREACT_MASTER_PROJECT)
set(UREACT_MASTER_PROJECT OFF)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(UREACT_MASTER_PROJECT ON)
message(STATUS "CMake version: ${CMAKE_VERSION}")
endif()
endif()

# Options that control generation of various targets.
option(UREACT_PEDANTIC "Enable extra warnings and expensive tests." OFF)
option(
UREACT_PEDANTIC
"Enable extra warnings and expensive tests."
${UREACT_MASTER_PROJECT}
)
option(
UREACT_WERROR
"Halt the compilation with an error on compiler warnings."
OFF
${UREACT_MASTER_PROJECT}
)
option(UREACT_TEST "Generate the test target." ${UREACT_MASTER_PROJECT})
option(UREACT_INSTALL "Generate install target." ${UREACT_MASTER_PROJECT})
option(UREACT_СTEST "Generate the CTest targets for CI." n)

message(STATUS "ureact version: ${UREACT_VERSION}${UREACT_VERSION_LABEL}")
if(UREACT_MASTER_PROJECT)
message(STATUS "ureact version: ${UREACT_VERSION}${UREACT_VERSION_LABEL}")
endif()

if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
Expand All @@ -73,7 +78,12 @@ endif()
if(UREACT_WERROR)
set_werror_flag(UREACT_WARNING_OPTION)
endif()
message(STATUS "ureact compiler warning options: \"${UREACT_WARNING_OPTION}\"")
if(UREACT_MASTER_PROJECT)
message(
STATUS
"ureact compiler warning options: \"${UREACT_WARNING_OPTION}\""
)
endif()

### ureact
add_library(ureact INTERFACE)
Expand Down

0 comments on commit cc7b04e

Please sign in to comment.