Improved CMakeLists.txt
authorGuilherme Maciel Ferreira <guilherme.maciel.ferreira@intra2net.com>
Mon, 21 Feb 2011 10:01:20 +0000 (11:01 +0100)
committerGuilherme Maciel Ferreira <guilherme.maciel.ferreira@intra2net.com>
Mon, 21 Feb 2011 10:01:20 +0000 (11:01 +0100)
CMakeLists.txt
src/CMakeLists.txt

index 7abe55e..ea9aa73 100644 (file)
@@ -1,7 +1,10 @@
+cmake_minimum_required( VERSION 2.6 )
+
 # project definitions
 project( libpingcheck CXX )
-set( VERSION 0.0.1 )
-cmake_minimum_required( VERSION 2.6 )
+set( MAJOR_VERSION 0 )
+set( MINOR_VERSION 1 )
+set( VERSION_STRING ${MAJOR_VERSION}.${MINOR_VERSION} )
 
 # set the directory where the executable will be placed
 set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} )
@@ -9,5 +12,11 @@ set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} )
 # set the directory where the make install places the executable
 #set( CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR} )
 
+# enable or disable the full compiler output
+set( CMAKE_VERBOSE_MAKEFILE OFF )
+
+# add definitions, compiler switches, etc.
+add_definitions( -Werror -Wall -Wextra -O2 )
+
 # more build in the source folder
 add_subdirectory( src )
index 534b156..bfc5dce 100644 (file)
@@ -1,20 +1,19 @@
-# binary name
-set( TARGET pingcheck )
-
 # required boost libraries
 set( Boost_USE_STATIC_LIBS ON )
 set( Boost_USE_MULTITHREADED ON )
 set( Boost_USE_STATIC_RUNTIME OFF )
-find_package( Boost 1.36.0 REQUIRED COMPONENTS filesystem )
+find_package( Boost COMPONENTS filesystem program_options REQUIRED )
 
-include_directories( config )
-include_directories( ping )
-include_directories( ${Boost_INCLUDE_DIRS} )
+# include directories
+include_directories(
+    config
+    ping
+    ${Boost_INCLUDE_DIRS}
+)
 
+# source code
 set( SOURCES
     config/configuration.cpp
-    config/configurationcommandline.cpp
-    config/configurationfile.cpp
     config/configurationreader.cpp
     ping/boostpinger.cpp
     ping/host.cpp
@@ -26,6 +25,9 @@ set( SOURCES
     main.cpp
 )
 
+# binary name
+set( TARGET pingcheck )
+
 # creates the binary
 add_executable( ${TARGET} ${SOURCES} )
 
@@ -33,4 +35,4 @@ add_executable( ${TARGET} ${SOURCES} )
 target_link_libraries( ${TARGET} ${Boost_LIBRARIES} )
 
 # creates the install rule for the binary
-install( TARGETS ${TARGET} DESTINATION . )
+install( TARGETS ${TARGET} DESTINATION bin )