[CMake] how to link mysql++ in a lib with cmake

Eric Noulard eric.noulard at gmail.com
Sat Jan 21 08:00:53 EST 2012


2012/1/21  <pasparis at noos.fr>:
> Hello
>
> I am trying to link mysql++ in a lib, with the following cmakelist.txt file:
> I get a fatal error: mysql_version.h no such a file or directory
> this file is located in usr/include/mysql so I don't understand
> thanks in advance if someone can help

May be you simply miss the leading "/"

include_directories(usr/include/mysql)
-->
include_directories(/usr/include/mysql)

> project(plibb)
>
> include_directories(usr/include)
> include_directories(usr/include/mysql)
> include_directories(usr/include/mysql++)
>
> add_library(plibb STATIC exec_msg2.cpp cTest2.cpp cDB.cpp)
>
> target_link_libraries(plibb  usr/lib/libmysqlpp.a)
> target_link_libraries(plibb  usr/lib/libmysqlclient.a)

You have a look at find_path and find_library commands.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list