[CMake] cmake and boost
Nehme Bilal
nbilal at mirarco.org
Fri Mar 19 14:00:02 EDT 2010
Hello all,
I am a not very familiar with Cmake but I am starting a
new project based on cmake and trying to add boost
libraries to my project.
Fortunately boost now provide a cmake configuration and a
description on how to use this configuration that can be
found here:
http://sodium.resophonic.com/boost-cmake/current-docs/exported_targets.html
I tried the first option (With an uninstalled build) as
described in the link above:
I created a test project that looks like:
Boost_cmake_test/
/boost
/src
/build
/CMakeLists.txt
/main.cpp
First I did a build of boost libraries in
(Boost_cmake_test/boost/build):
I created the boost project using cmake2.8.0 and compiled
it using visual studio 2010.
- Boost_cmake_test/CMakeLists.txt contains:
##########################################
cmake_minimum_required(VERSION 2.6.4 FATAL_ERROR)
include_directories(
boost/src
boost/build/lib/Exports.cmake
)
add_executable(my_program main.cpp)
target_link_libraries(my_program
boost_date_time-mt-shared)
##########################################
- main.cpp is just an empty main:
//---------------------------------
#include <iostream>
int main()
{
return 1;
}
//---------------------------------
when I compile the project in visual studio, I get this
error:
1>LINK : fatal error LNK1104: cannot open file
'boost_date_time-mt-shared.lib'
I looked into Exports.cmake file and the section
corresponding to boost_date_time-mt-shared looks like:
# Create imported target boost_date_time-mt-shared
ADD_LIBRARY(boost_date_time-mt-shared SHARED IMPORTED)
# Import target "boost_date_time-mt-shared" for
configuration "Debug"
SET_PROPERTY(TARGET boost_date_time-mt-shared APPEND
PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
SET_TARGET_PROPERTIES(boost_date_time-mt-shared PROPERTIES
IMPORTED_IMPLIB_DEBUG
"C:/Users/nbilal/Desktop/boost_cmake_test/boost/build/lib/Debug/boost_date_time-vc-mt-1_41.lib"
IMPORTED_LOCATION_DEBUG
"C:/Users/nbilal/Desktop/boost_cmake_test/boost/build/bin/Debug/boost_date_time-vc-mt-1_41.dll"
)
Can someone help please ? I just not able to do any work
before fixing this problem.
Thank you !
More information about the CMake
mailing list