Changes to CMakeLists:
authorDmitriy Morozov <morozov@cs.duke.edu>
Fri, 14 Sep 2007 17:32:11 -0400
changeset 32 075da5d7d6c3
parent 31 7a1bcccad811
child 33 3318eb317618
Changes to CMakeLists: * Optimize and debug options derive flags from CMKAE_CXX_FLAGS* * Moved CGAL CXX flags from the top level to the specific locations where they are required
CMakeLists.txt
examples/alphashapes/CMakeLists.txt
examples/ar-vineyard/CMakeLists.txt
examples/grid/CMakeLists.txt
--- a/CMakeLists.txt	Fri Sep 14 06:34:43 2007 -0400
+++ b/CMakeLists.txt	Fri Sep 14 17:32:11 2007 -0400
@@ -24,7 +24,6 @@
 #string						(REPLACE "\n" "" cgal_ldflags 	${cgal_ldflags})
 string						(REPLACE "\n" "" cgal_cxxflags 	${cgal_cxxflags})
 string						(REPLACE "\n" "" cgal_libpath 	${cgal_libpath})
-add_definitions				(${cgal_cxxflags})
 find_library				(cgal_LIBRARY				NAMES CGAL
 														PATHS ${cgal_libpath})
 find_library				(core_LIBRARY				NAMES CGALcore++
@@ -43,10 +42,19 @@
 
 # Debugging
 if							(debug)
-	add_definitions			(-g)
+	if 						(optimize)
+			set				(cxx_flags					${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
+	else					(optimize)
+			set				(cxx_flags					${CMAKE_CXX_FLAGS_DEBUG})
+	endif					(optimize)
 else						(debug)
-	add_definitions			(-DNDEBUG)
+	if 						(optimize)
+			set				(cxx_flags					${CMAKE_CXX_FLAGS_RELEASE})
+	else					(optimize)
+			set				(cxx_flags					${CMAKE_CXX_FLAGS})
+	endif					(optimize)
 endif						(debug)
+add_definitions				(${cxx_flags})
 
 # Logging
 if 							(logging)
@@ -62,14 +70,6 @@
 	add_definitions			(-DCOUNTERS)
 endif						(counters)
 
-# Optimization
-if							(optimize GREATER 0)
-	add_definitions			(-O${optimize})
-elseif						(optimize)
-	add_definitions			(-O)
-endif						(optimize)
-endif						(optimize GREATER 0)
-
 
 # Set includes
 include_directories			(${CMAKE_CURRENT_BINARY_DIR}
--- a/examples/alphashapes/CMakeLists.txt	Fri Sep 14 06:34:43 2007 -0400
+++ b/examples/alphashapes/CMakeLists.txt	Fri Sep 14 17:32:11 2007 -0400
@@ -2,6 +2,7 @@
 							 alphashapes3d
 							 alpharadius)
 							 
+add_definitions				(${cgal_cxxflags})
 foreach 					(t ${targets})
 	add_executable			(${t} ${t}.cpp)
 	target_link_libraries	(${t} ${libraries} ${cgal_libraries})
--- a/examples/ar-vineyard/CMakeLists.txt	Fri Sep 14 06:34:43 2007 -0400
+++ b/examples/ar-vineyard/CMakeLists.txt	Fri Sep 14 17:32:11 2007 -0400
@@ -1,6 +1,7 @@
 set							(targets						
 							 ar-vineyard)
 							 
+add_definitions				(${cgal_cxxflags})
 foreach 					(t ${targets})
 	add_executable			(${t} ${t}.cpp)
 	target_link_libraries	(${t} ${libraries} ${cgal_libraries})
--- a/examples/grid/CMakeLists.txt	Fri Sep 14 06:34:43 2007 -0400
+++ b/examples/grid/CMakeLists.txt	Fri Sep 14 17:32:11 2007 -0400
@@ -3,6 +3,7 @@
 							 pdbdistance-vineyard
 							 combustion-vineyard)
 							 
+add_definitions				(${cgal_cxxflags})
 foreach 					(t ${targets})
 	add_executable			(${t} ${t}.cpp)
 	target_link_libraries	(${t} ${libraries} ${cgal_libraries} ${dsrpdb_LIBRARY})