Boost logo

Boost Users :

Subject: Re: [Boost-users] Problem with linking files using boost::log with CMake Buildfile
From: Michael Chisholm (chisholm_at_[hidden])
Date: 2013-12-05 18:48:28

On 12/5/2013 4:13 PM, David Georg Reichelt wrote:
> Hi,
> I've got problems compiling a program using boost with CMake (using
> Windows and MinGW 4.7.2, with -G "MinGW Makefiles"). Boost is compiled
> normaly with b2.exe --toolset=gcc --prefix=C:\cppLib\boost_1_55_0 and
> the folder seems to contain the right files. The original CMake-File
> compiled fine using Ubuntu. I've got a code using only boost::log and a
> CMake File containing the following boost-related-code:
> ADD_DEFINITIONS("-std=c++0x")
> SET(BOOST_ROOT "C:/cppLib/boost_1_55_0/")
> link_libraries (${Boost_LIBRARIES})
> find_package( Boost 1.54.0 COMPONENTS log)
> if(Boost_FOUND)
> MESSAGE("Boost found")
> include_directories(${Boost_INCLUDE_DIRS})
> add_executable(Hasselbrack ${AUTO_SOURCES})
> endif()

Just a quick reaction: why do you link boost libraries before you know
whether boost was found? Would it make more sense to move
link_libraries() into the if(Boost_FOUND) block?


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at