Skip to content

Commit 6db9a61

Browse files
committed
Moved boost #defines from code to CMakeLists
1 parent 2a547d0 commit 6db9a61

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ if(NOT EXISTS "${OpenCV_haarcascades_DIR}/haarcascade_frontalface_alt2.xml")
5858
message(FATAL_ERROR "Could not find OpenCV's face detector haarcascade_frontalface_alt2.xml in ${OpenCV_haarcascades_DIR}. Please set OpenCV_haarcascades_DIR to the directory with that file.")
5959
endif()
6060

61+
if(MSVC)
62+
# The standard find_package for boost on Win finds the dynamic libs, so for dynamic linking to boost we need to #define:
63+
add_definitions(-DBOOST_ALL_NO_LIB) # Don't use the automatic library linking by boost with VS (#pragma ...). Instead, we specify everything here in cmake.
64+
add_definitions(-DBOOST_ALL_DYN_LINK) # Link against the dynamic boost lib - needs to match with the version that find_package finds.
65+
endif()
6166
find_package(Boost 1.48.0 COMPONENTS system filesystem program_options REQUIRED)
6267
if(Boost_FOUND)
6368
message(STATUS "Boost found at ${Boost_INCLUDE_DIRS}")

apps/4dface.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@
3737
#include "opencv2/highgui/highgui.hpp"
3838
#include "opencv2/objdetect/objdetect.hpp"
3939

40-
#ifdef WIN32
41-
#define BOOST_ALL_DYN_LINK // Link against the dynamic boost lib. Seems to be necessary because we use /MD, i.e. link to the dynamic CRT.
42-
#define BOOST_ALL_NO_LIB // Don't use the automatic library linking by boost with VS2010 (#pragma ...). Instead, we specify everything in cmake.
43-
#endif
4440
#include "boost/program_options.hpp"
4541
#include "boost/filesystem.hpp"
4642

0 commit comments

Comments
 (0)