Pārlūkot izejas kodu

Improve CMakeLists.txt for mac os

Eric RAMAT 8 gadi atpakaļ
vecāks
revīzija
daf5be5367
2 mainītis faili ar 18 papildinājumiem un 12 dzēšanām
  1. 1 0
      .gitignore
  2. 17 12
      CMakeLists.txt

+ 1 - 0
.gitignore

@@ -1,2 +1,3 @@
+.idea
 *~
 build/

+ 17 - 12
CMakeLists.txt

@@ -44,17 +44,22 @@ SET (ARTIS_APP_PROPERTIES SOVERSION "${ARTIS_MAJOR}.${ARTIS_MINOR}"
 INCLUDE(CMakeCPack.cmake)
 
 #
- # Debug mode
+# Append debug mode when compiler is GNU.
 #
 
-IF (CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX)
-  SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
-  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -std=c++11 -pthread")
-  IF (UNIX)
-    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic")
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
-  ENDIF (UNIX)
-ENDIF (CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX)
+if (CMAKE_BUILD_TYPE STREQUAL "")
+  SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build" FORCE)
+endif ()
+
+if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -std=c++11")
+
+  if ("${CMAKE_BUILD_TYPE}" EQUAL "Debug" OR "${CMAKE_BUILD_TYPE}" EQUAL "RelWithDebInfo")
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb3")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb3")
+  endif ()
+endif ()
 
 if (CMAKE_BUILD_TYPE STREQUAL "")
   SET(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build" FORCE)
@@ -96,9 +101,9 @@ SET(Boost_DETAILED_FAILURE_MSG FALSE)
 SET(Boost_DEBUG FALSE)
 
 FIND_PACKAGE(Boost COMPONENTS date_time serialization system)
-IF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "35")
-  SET(Boost_SYSTEM_LIBRARY "")
-ENDIF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "35")
+#IF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "35")
+#  SET(Boost_SYSTEM_LIBRARY "")
+#ENDIF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "35")
 
 #
  # Generate the config.h