3232
3333cmake_minimum_required (VERSION 3.2)
3434
35- if (DEBUG)
36- message (STATUS "Building Debug build" )
37- else ()
38- message (STATUS "Building RelWithDebInfo build" )
39- endif (DEBUG)
40-
4135function (append_property_string type target name value )
4236 # XXX: if we require cmake 2.8.6 we can simply use APPEND_STRING
4337 get_property (cur ${type} ${target} PROPERTY ${name} )
@@ -88,6 +82,8 @@ else ("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
8882 set (location_suffix "" )
8983endif ("${CMAKE_GENERATOR} " MATCHES "Visual Studio" )
9084
85+ message ("Generated with config types: ${CMAKE_CONFIGURATION_TYPES} " )
86+
9187project (drltrace)
9288
9389if ("${CMAKE_VERSION} " VERSION_EQUAL "3.0" OR
@@ -252,7 +248,7 @@ if (WIN32)
252248 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CL_CFLAGS} " )
253249 add_definitions (-D_CRT_SECURE_NO_WARNINGS)
254250 if (DEBUG)
255- #set(OPT_CFLAGS "/DFEBUG ")
251+ #set(OPT_CFLAGS "/DEBUG ")
256252 add_definitions (-DDEBUG)
257253 endif (DEBUG)
258254endif (WIN32 )
@@ -262,6 +258,11 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPT_CFLAGS}")
262258set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OPT_CFLAGS} " )
263259#endif ()
264260
261+ if (UNIX )
262+ set (EXTRA_CXXFLAGS "-std=c++11" )
263+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS} " )
264+ endif ()
265+
265266#include(${PROJECT_SOURCE_DIR}/make/policies.cmake NO_POLICY_SCOPE)
266267
267268##################################################
@@ -274,6 +275,21 @@ set(front_srcs
274275# set(front_srcs ${front_srcs} ${PROJECT_SOURCE_DIR}/make/resources.rc)
275276#endif ()
276277
278+ macro (fix_win32_flags srcfile)
279+ if (WIN32 )
280+ if (DEBUG)
281+ get_property (cur SOURCE ${srcfile} PROPERTY COMPILE_FLAGS )
282+ string (REPLACE "/MTd " "" cur "${cur} " ) # Avoid override warning.
283+ set_source_files_properties (${srcfile} PROPERTIES COMPILE_FLAGS "${cur} /EHsc /MTd" )
284+ append_property_string(SOURCE ${srcfile} LINK_FLAGS "/nodefaultlib:libcmt" )
285+ else ()
286+ append_property_string(SOURCE ${srcfile} COMPILE_FLAGS "/EHsc /MT" )
287+ endif ()
288+ endif ()
289+ endmacro ()
290+
291+ fix_win32_flags(drltrace_frontend.cpp)
292+
277293add_executable (drltrace ${front_srcs} )
278294
279295#set_library_version(drltrace ${DRMF_VERSION})
@@ -425,7 +441,6 @@ else()
425441 set (drltrace_path "${drltrace_path} /drltrace" )
426442 set (app_path "${app_path} /drltrace_app" )
427443endif (WIN32 )
428- message (${drltrace_path} , ${app_path} )
429444
430445 prefix_cmd_if_necessary(drltrace_path OFF ${drltrace_path} )
431446
0 commit comments