From 235ffac2d309851a52a6a24e9df6e2e4066c0223 Mon Sep 17 00:00:00 2001 From: Guilherme Maciel Ferreira Date: Wed, 23 Feb 2011 15:22:05 +0100 Subject: [PATCH] Moved boost library search to the main CMakeLists.txt file, so cmake knows right from the beginning which libraries are required --- CMakeLists.txt | 13 ++++++++++--- src/CMakeLists.txt | 10 ++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 877ebe6..86d0f55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,9 @@ set( MAJOR_VERSION 0 ) set( MINOR_VERSION 1 ) set( VERSION_STRING ${MAJOR_VERSION}.${MINOR_VERSION} ) +# build type +set( CMAKE_BUILD_TYPE Debug ) + # set the directory where the executable will be placed set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) @@ -15,13 +18,17 @@ set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) # enable or disable the full compiler output set( CMAKE_VERBOSE_MAKEFILE OFF ) -set( CMAKE_BUILD_TYPE Debug ) - # add definitions, compiler switches, etc. add_definitions( -Werror -Wall -Wextra -Weffc++ -O2 -DVERSION_STRING=${VERSION_STRING} -DPROJECT_NAME=\"${PROJECT_NAME}\" ) -# more build in the source folder +# required boost libraries +set( Boost_USE_STATIC_LIBS ON ) +set( Boost_USE_MULTITHREADED ON ) +set( Boost_USE_STATIC_RUNTIME OFF ) +find_package( Boost COMPONENTS filesystem program_options REQUIRED ) + +# build the application in the source directory add_subdirectory( src ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bfc5dce..bca280b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,17 +1,11 @@ -# required boost libraries -set( Boost_USE_STATIC_LIBS ON ) -set( Boost_USE_MULTITHREADED ON ) -set( Boost_USE_STATIC_RUNTIME OFF ) -find_package( Boost COMPONENTS filesystem program_options REQUIRED ) - -# include directories +# include directories where the source code is located include_directories( config ping ${Boost_INCLUDE_DIRS} ) -# source code +# source code files set( SOURCES config/configuration.cpp config/configurationreader.cpp -- 1.7.1