# Using Phobos OR Tango (can be specified from cmake command line)
if (NOT CMAKE_D_USE_PHOBOS AND NOT CMAKE_D_USE_TANGO)
- # default to phobos
- message(STATUS "This application can be built with either Phobos or Tango!")
- message(STATUS "You did not specify a standard library -- defaulting to Phobos.")
- message(STATUS "If you wish to use Tango add -DCMAKE_D_USE_TANGO=True to cmake command line.")
- set(CMAKE_D_USE_PHOBOS True)
+ # default to phobos
+ message(STATUS "This application can be built with either Phobos or Tango!")
+ message(STATUS "You did not specify a standard library -- defaulting to Phobos.")
+ message(STATUS "If you wish to use Tango add -DCMAKE_D_USE_TANGO=True to cmake command line.")
+ set(CMAKE_D_USE_PHOBOS True)
endif (NOT CMAKE_D_USE_PHOBOS AND NOT CMAKE_D_USE_TANGO)
INCLUDE(CMakeDetermineCCompiler)
# warn about functions without format attribute that should have one
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-format-attribute")
# }}}
+# D flags {{{
+# big debug flags
+SET(CMAKE_D_FLAGS "${CMAKE_D_FLAGS} -ggdb3")
+# Use pipes and not temp files.
+SET(CMAKE_D_FLAGS "${CMAKE_D_FLAGS} -pipe")
+# optimize even more
+SET(CMAKE_D_FLAGS "${CMAKE_D_FLAGS} -O2")
+# let the type char be unsigned by default
+SET(CMAKE_D_FLAGS "${CMAKE_D_FLAGS} -funsigned-char")
+SET(CMAKE_D_FLAGS "${CMAKE_D_FLAGS} -fstrict-aliasing")
+# turn on all common warnings
+SET(CMAKE_D_FLAGS "${CMAKE_D_FLAGS} -Wall")
+# turn on extra warnings
+SET(CMAKE_D_FLAGS "${CMAKE_D_FLAGS} -W")
+# treat warnings as errors
+#SET(CMAKE_D_FLAGS "${CMAKE_D_FLAGS} -Werror")
+# warn about local variable shadowing another local variable
+SET(CMAKE_D_FLAGS "${CMAKE_D_FLAGS} -Wshadow")
+# warn about casting of pointers to increased alignment requirements
+SET(CMAKE_D_FLAGS "${CMAKE_D_FLAGS} -Wcast-align")
+# warn about comparisons between signed and unsigned values
+SET(CMAKE_D_FLAGS "${CMAKE_D_FLAGS} -Wsign-compare")
+# warn about unused declared stuff
+SET(CMAKE_D_FLAGS "${CMAKE_D_FLAGS} -Wunused")
+SET(CMAKE_D_FLAGS "${CMAKE_D_FLAGS} -Wno-unused-parameter")
+# warn about variable use before initialization
+SET(CMAKE_D_FLAGS "${CMAKE_D_FLAGS} -Wuninitialized")
+# }}}
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)