瀏覽代碼

Added GLM_QUIET

Christophe Riccio 7 年之前
父節點
當前提交
aff5b7a02d
共有 1 個文件被更改,包括 31 次插入10 次删除
  1. 31 10
      CMakeLists.txt

+ 31 - 10
CMakeLists.txt

@@ -11,6 +11,7 @@ include(CMakePackageConfigHelpers)
 
 enable_testing()
 
+option(GLM_QUIET "No CMake Message" OFF)
 option(GLM_TEST_ENABLE_CXX_98 "Enable C++ 98" OFF)
 option(GLM_TEST_ENABLE_CXX_11 "Enable C++ 11" OFF)
 option(GLM_TEST_ENABLE_CXX_14 "Enable C++ 14" OFF)
@@ -22,27 +23,37 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
 if(GLM_TEST_ENABLE_CXX_20)
 	set(CMAKE_CXX_STANDARD 20)
 	add_definitions(-DGLM_FORCE_CXX2A)
-	message(STATUS "GLM: Build with C++20 features")
+	if(NOT GLM_QUIET)
+		message(STATUS "GLM: Build with C++20 features")
+	endif()
 
 elseif(GLM_TEST_ENABLE_CXX_17)
 	set(CMAKE_CXX_STANDARD 17)
 	add_definitions(-DGLM_FORCE_CXX17)
-	message(STATUS "GLM: Build with C++17 features")
+	if(NOT GLM_QUIET)
+		message(STATUS "GLM: Build with C++17 features")
+	endif()
 
 elseif(GLM_TEST_ENABLE_CXX_14)
 	set(CMAKE_CXX_STANDARD 14)
 	add_definitions(-DGLM_FORCE_CXX14)
-	message(STATUS "GLM: Build with C++14 features")
+	if(NOT GLM_QUIET)
+		message(STATUS "GLM: Build with C++14 features")
+	endif()
 
 elseif(GLM_TEST_ENABLE_CXX_11)
 	set(CMAKE_CXX_STANDARD 11)
 	add_definitions(-DGLM_FORCE_CXX11)
-	message(STATUS "GLM: Build with C++11 features")
+	if(NOT GLM_QUIET)
+		message(STATUS "GLM: Build with C++11 features")
+	endif()
 
 elseif(GLM_TEST_ENABLE_CXX_98)
 	set(CMAKE_CXX_STANDARD 98)
 	add_definitions(-DGLM_FORCE_CXX98)
-	message(STATUS "GLM: Build with C++98 features")
+	if(NOT GLM_QUIET)
+		message(STATUS "GLM: Build with C++98 features")
+	endif()
 endif()
 
 option(GLM_TEST_ENABLE_LANG_EXTENSIONS "Enable language extensions" OFF)
@@ -65,7 +76,9 @@ endif()
 
 option(GLM_TEST_ENABLE_FAST_MATH "Enable fast math optimizations" OFF)
 if(GLM_TEST_ENABLE_FAST_MATH)
-	message(STATUS "GLM: Build with fast math optimizations")
+	if(NOT GLM_QUIET)
+		message(STATUS "GLM: Build with fast math optimizations")
+	endif()
 
 	if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "GNU"))
 		add_compile_options(-ffast-math)
@@ -171,23 +184,31 @@ endif()
 # Compiler and default options
 
 if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-	message("GLM: Clang - ${CMAKE_CXX_COMPILER_ID} compiler")
+	if(NOT GLM_QUIET)
+		message("GLM: Clang - ${CMAKE_CXX_COMPILER_ID} compiler")
+	endif()
 
 	add_compile_options(-Werror -Weverything)
 	add_compile_options(-Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-c++11-long-long -Wno-padded -Wno-gnu-anonymous-struct -Wno-nested-anon-types)
 	add_compile_options(-Wno-undefined-reinterpret-cast -Wno-sign-conversion -Wno-unused-variable -Wno-missing-prototypes -Wno-unreachable-code -Wno-missing-variable-declarations -Wno-sign-compare -Wno-global-constructors -Wno-unused-macros -Wno-format-nonliteral)
 
 elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
-	message("GLM: GCC - ${CMAKE_CXX_COMPILER_ID} compiler")
+	if(NOT GLM_QUIET)
+		message("GLM: GCC - ${CMAKE_CXX_COMPILER_ID} compiler")
+	endif()
 
 	add_compile_options(-O2)
 	add_compile_options(-Wno-long-long)
 
 elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
-	message("GLM: Intel - ${CMAKE_CXX_COMPILER_ID} compiler")
+	if(NOT GLM_QUIET)
+		message("GLM: Intel - ${CMAKE_CXX_COMPILER_ID} compiler")
+	endif()
 
 elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
-	message("GLM: Visual C++ - ${CMAKE_CXX_COMPILER_ID} compiler")
+	if(NOT GLM_QUIET)
+		message("GLM: Visual C++ - ${CMAKE_CXX_COMPILER_ID} compiler")
+	endif()
 
 	add_compile_options(/W4 /WX)
 	add_compile_options(/wd4309 /wd4324 /wd4389 /wd4127 /wd4267 /wd4146 /wd4201 /wd4464 /wd4514 /wd4701 /wd4820 /wd4365)