Simplified cmake scripts

This commit is contained in:
Davis King 2013-02-10 14:14:33 -05:00
parent bbfcf2557b
commit 0a39006dea
3 changed files with 13 additions and 39 deletions

View File

@ -142,26 +142,19 @@ PROJECT(${target_name})
# cmake that they are part of our target (which is the executable named test)
ADD_EXECUTABLE(${target_name} main.cpp tester.cpp ${tests})
# add the folder containing the dlib folder to the include path
INCLUDE_DIRECTORIES(../..)
# Turn on all warnings when using gcc.
if (CMAKE_COMPILER_IS_GNUCXX)
add_definitions("-W -Wall")
endif()
# There is a CMakeLists.txt file in the dlib source folder that tells cmake
# how to build the dlib library. Tell cmake about that file.
add_subdirectory(.. dlib_build)
# Tell cmake to link our target executable to dlib.
include(../cmake)
TARGET_LINK_LIBRARIES(${target_name} dlib )
if (NOT DLIB_NO_GUI_SUPPORT)
add_subdirectory(gui)
endif()
# Tell cmake to link our target executable to the non-gui version of the dlib
# library.
TARGET_LINK_LIBRARIES(${target_name} dlib )
# make the default build be in "Release" mode
include(../release_build_by_default)

View File

@ -12,14 +12,9 @@ PROJECT(${target_name})
# cmake that they are part of our target (which is the executable named test)
ADD_EXECUTABLE(${target_name} main.cpp )
# add the folder containing the dlib folder to the include path
# Add the folder containing the dlib folder to the include path
INCLUDE_DIRECTORIES(../../..)
# There is a CMakeLists.txt file in the dlib source folder that tells cmake
# how to build the dlib library. Tell cmake about that file.
# Tell cmake to link our target executable to the non-gui version of the dlib
# library.
# Tell cmake to link our target executable to dlib.
TARGET_LINK_LIBRARIES(${target_name} dlib )

View File

@ -4,30 +4,16 @@
#
# setting this makes CMake allow normal looking IF ELSE statements
SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
cmake_minimum_required(VERSION 2.4)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif()
#set default build type to Release
include(../dlib/release_build_by_default)
cmake_minimum_required(VERSION 2.6)
PROJECT(examples)
# add the folder containing the dlib folder to the include path
INCLUDE_DIRECTORIES(..)
# There is a CMakeLists.txt file in the dlib source folder that tells cmake
# how to build the dlib library. Tell cmake about that file.
add_subdirectory(../dlib dlib_build)
include(../dlib/cmake)
# We are going to use a macro to add all the example programs. However,
# usually you will only create one executable in your cmake projects.
# Therefore, you would just need to invoke ADD_EXECUTABLE() and
# TARGET_LINK_LIBRARIES() as shown below.
MACRO(add_example name)
ADD_EXECUTABLE(${name} ${name}.cpp)
TARGET_LINK_LIBRARIES(${name} dlib )