Commit 3509234e authored by Patrik Huber's avatar Patrik Huber

Removed #defines for boost linking and added the flags to CMake instead

parent 136ae7cc
...@@ -70,6 +70,11 @@ find_package(OpenCV 2.4.3 REQUIRED core) ...@@ -70,6 +70,11 @@ find_package(OpenCV 2.4.3 REQUIRED core)
message(STATUS "OpenCV include dir found at ${OpenCV_INCLUDE_DIRS}") message(STATUS "OpenCV include dir found at ${OpenCV_INCLUDE_DIRS}")
message(STATUS "OpenCV lib dir found at ${OpenCV_LIB_DIR}") message(STATUS "OpenCV lib dir found at ${OpenCV_LIB_DIR}")
if(MSVC)
# The standard find_package for boost on Win finds the dynamic libs, so for dynamic linking to boost we need to #define:
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.
add_definitions(-DBOOST_ALL_DYN_LINK) # Link against the dynamic boost lib - needs to match with the version that find_package finds.
endif()
find_package(Boost 1.50.0 COMPONENTS system REQUIRED) find_package(Boost 1.50.0 COMPONENTS system REQUIRED)
if(Boost_FOUND) if(Boost_FOUND)
message(STATUS "Boost found at ${Boost_INCLUDE_DIRS}") message(STATUS "Boost found at ${Boost_INCLUDE_DIRS}")
......
...@@ -17,6 +17,11 @@ message(STATUS "OpenCV lib dir found at ${OpenCV_LIB_DIR}") ...@@ -17,6 +17,11 @@ message(STATUS "OpenCV lib dir found at ${OpenCV_LIB_DIR}")
# This allows us to compile in RelWithDebInfo. It'll use the Release-version of OpenCV: # This allows us to compile in RelWithDebInfo. It'll use the Release-version of OpenCV:
set_target_properties(${OpenCV_LIBS} PROPERTIES MAP_IMPORTED_CONFIG_RELWITHDEBINFO RELEASE) set_target_properties(${OpenCV_LIBS} PROPERTIES MAP_IMPORTED_CONFIG_RELWITHDEBINFO RELEASE)
if(MSVC)
# The standard find_package for boost on Win finds the dynamic libs, so for dynamic linking to boost we need to #define:
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.
add_definitions(-DBOOST_ALL_DYN_LINK) # Link against the dynamic boost lib - needs to match with the version that find_package finds.
endif()
find_package(Boost 1.50.0 COMPONENTS system filesystem program_options REQUIRED) find_package(Boost 1.50.0 COMPONENTS system filesystem program_options REQUIRED)
if(Boost_FOUND) if(Boost_FOUND)
message(STATUS "Boost found at ${Boost_INCLUDE_DIRS}") message(STATUS "Boost found at ${Boost_INCLUDE_DIRS}")
......
...@@ -27,10 +27,6 @@ ...@@ -27,10 +27,6 @@
#include "opencv2/core/core.hpp" #include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp" #include "opencv2/highgui/highgui.hpp"
#ifdef WIN32
#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.
#define BOOST_ALL_NO_LIB // Don't use the automatic library linking by boost with VS2010 (#pragma ...). Instead, we specify everything in cmake.
#endif
#include "boost/program_options.hpp" #include "boost/program_options.hpp"
#include "boost/filesystem.hpp" #include "boost/filesystem.hpp"
......
...@@ -22,10 +22,6 @@ ...@@ -22,10 +22,6 @@
#include "opencv2/core/core.hpp" #include "opencv2/core/core.hpp"
#ifdef WIN32
#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.
#define BOOST_ALL_NO_LIB // Don't use the automatic library linking by boost with VS2010 (#pragma ...). Instead, we specify everything in cmake.
#endif
#include "boost/program_options.hpp" #include "boost/program_options.hpp"
#include "boost/filesystem.hpp" #include "boost/filesystem.hpp"
......
...@@ -22,10 +22,6 @@ ...@@ -22,10 +22,6 @@
#ifndef LANDMARKMAPPER_HPP_ #ifndef LANDMARKMAPPER_HPP_
#define LANDMARKMAPPER_HPP_ #define LANDMARKMAPPER_HPP_
#ifdef WIN32
#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.
#define BOOST_ALL_NO_LIB // Don't use the automatic library linking by boost with VS2010 (#pragma ...). Instead, we specify everything in cmake.
#endif
#include "boost/optional.hpp" #include "boost/optional.hpp"
#include "boost/filesystem/path.hpp" #include "boost/filesystem/path.hpp"
#include "boost/property_tree/ptree.hpp" #include "boost/property_tree/ptree.hpp"
......
...@@ -31,10 +31,6 @@ ...@@ -31,10 +31,6 @@
#include "opencv2/core/core.hpp" #include "opencv2/core/core.hpp"
#ifdef WIN32
#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.
#define BOOST_ALL_NO_LIB // Don't use the automatic library linking by boost with VS2010 (#pragma ...). Instead, we specify everything in cmake.
#endif
#include "boost/property_tree/ptree.hpp" #include "boost/property_tree/ptree.hpp"
#include "boost/property_tree/info_parser.hpp" #include "boost/property_tree/info_parser.hpp"
......
...@@ -26,10 +26,6 @@ ...@@ -26,10 +26,6 @@
#include "opencv2/core/core.hpp" #include "opencv2/core/core.hpp"
#ifdef WIN32
#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.
#define BOOST_ALL_NO_LIB // Don't use the automatic library linking by boost with VS2010 (#pragma ...). Instead, we specify everything in cmake.
#endif
#include "boost/filesystem/path.hpp" #include "boost/filesystem/path.hpp"
#include <vector> #include <vector>
......
...@@ -24,10 +24,6 @@ ...@@ -24,10 +24,6 @@
#include "opencv2/core/core.hpp" #include "opencv2/core/core.hpp"
#ifdef WIN32
#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.
#define BOOST_ALL_NO_LIB // Don't use the automatic library linking by boost with VS2010 (#pragma ...). Instead, we specify everything in cmake.
#endif
#include "boost/filesystem/path.hpp" #include "boost/filesystem/path.hpp"
#include <vector> #include <vector>
......
...@@ -24,10 +24,6 @@ ...@@ -24,10 +24,6 @@
#include "opencv2/core/core.hpp" #include "opencv2/core/core.hpp"
#ifdef WIN32
#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.
#define BOOST_ALL_NO_LIB // Don't use the automatic library linking by boost with VS2010 (#pragma ...). Instead, we specify everything in cmake.
#endif
#include "boost/optional.hpp" #include "boost/optional.hpp"
/** /**
......
...@@ -27,10 +27,6 @@ ...@@ -27,10 +27,6 @@
#include "opencv2/core/core.hpp" #include "opencv2/core/core.hpp"
#ifdef WIN32
#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.
#define BOOST_ALL_NO_LIB // Don't use the automatic library linking by boost with VS2010 (#pragma ...). Instead, we specify everything in cmake.
#endif
#include "boost/optional.hpp" #include "boost/optional.hpp"
#include <array> #include <array>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment