소스 검색

CMake: Add compiler options only for Clang and GCC

Max Bruckner 8 년 전
부모
커밋
302c574e00
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      CMakeLists.txt

+ 3 - 1
CMakeLists.txt

@@ -9,7 +9,9 @@ set(CJSON_VERSION_SO 1)
 set(CJSON_UTILS_VERSION_SO 1)
 set(CJSON_VERSION "${CJSON_VERSION_MAJOR}.${CJSON_VERSION_MINOR}.${CJSON_VERSION_PATCH}")
 
-add_compile_options(-ansi -pedantic -Wall -Wextra -Werror -Wstrict-prototypes -Wwrite-strings)
+if(("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang"))
+    add_compile_options(-ansi -pedantic -Wall -Wextra -Werror -Wstrict-prototypes -Wwrite-strings)
+endif()
 
 #variables for pkg-config
 set(prefix ${CMAKE_INSTALL_PREFIX})