[CMake] linking boost to cmake under OSX 10.12.1 , boost 1.63 , cmake 2017.11
Sean Wayland
seanwayland at gmail.com
Wed May 3 23:20:43 EDT 2017
Hi all,
I am very new to cmake and boost. Sorry if my question is basic thanks for
your help in advance.
I am having trouble linking a project to boost. I am using OSX 10.12.1
I am using clion 2017.1.1
I installed boost on my machine using /bootstrap.sh
--prefix=/usr/local/boost --with-libraries=filesystem,system
I also tried a brew install boost also .
Boost can indeed be found here *usr/local/boost/ *on my machine.
I haven't had much luck getting boost to link properly.
I believe the project uses the filesystem and tuple modules.
I am getting this error
CMake Error at CMakeLists.txt:557 (ADD_EXECUTABLE):
Cannot find source file:
anyExecutable.cpp
>From what I have read I think that if you are using OSX that you have to
use the FIND_PACKAGE command to link things properly. I suspect that the
code below doesn't work because I need to properly place the exact
filesystem location of the executable file created in the add_executable
command.
On a positive note I did get this message
-- Boost version: 1.63.0
-- Found the following Boost libraries:
-- program_options
-- Configuring done
I have tried various versions of these 2 cmakelists scripts below (A) and
(B)
Can anyone point me in the direction of a solution here?
*A) *
FIND_PACKAGE( Boost 1.63.0 COMPONENTS program_options REQUIRED )
INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} )
ADD_EXECUTABLE( anyExecutable anyExecutable.cpp )
TARGET_LINK_LIBRARIES( anyExecutable ${Boost_LIBRARIES} )
B)
INCLUDE_DIRECTORIES(*usr/local/boost/include/*)
ADD_EXECUTABLE( * anyExecutable myMain.cpp *)
TARGET_LINK_LIBRARIES( *anyExecutable usr/local/boost/lib/ *)
Thanks very much for your help .
Yours Sincerely
Sean Wayland
www.seanwayland.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170503/a4637d95/attachment.html>
More information about the CMake
mailing list