[CMake] Linking own header files to a source code

Peleg Bar-Sapir pelegs at gmail.com
Tue Jul 14 07:51:58 EDT 2015


Hello,

I'm trying to configure my own library (called "libtrace") to a test file I
made.

My source library contains the following files:
libtrace.h -- Header file for the libtrace library.
libtrace.cc -- Source file for the libtrace library.
test01.cc -- A test file that uses libtrace.
CMakeLists.txt -- CMake's config file.

I also have a MySQL connector linked to my project (in the manner Daniel
Schepler had helped me with back in late April) - so CMakeLists.txt looks
like this:
.......................................................................
cmake_minimum_required(VERSION 2.8)
project( Test )

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
"${CMAKE_SOURCE_DIR}/cmake/Modules/")

find_package( MySQL REQUIRED )
target_link_libraries( Test ${MYSQL_LIBRARY} )
include_directories(${MYSQL_INCLUDE_DIR})
.......................................................................

...I cannot seem to connect my own library with nay success (I followed the
tutorial from here: http://www.cmake.org/cmake-tutorial/ ). It keeps giving
me errors.

Any help with ordering the CMakeLists.txt file would be greatly appreciated.


Thanks,

Peleg Bar Sapir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150714/d454501a/attachment.html>


More information about the CMake mailing list