Hello,

To add your mentioned libraries to the executable you have to link against 
them. For this the cmake command

target_link_libraries() is used: 
https://cmake.org/cmake/help/v3.7/command/target_link_libraries.html

In your case the cmake code should look similar to this:

target_link_libraries(tsm armadillo lidsndfile)

best regards,
Michael

From: CMake [mailto:cmake-boun...@cmake.org] On Behalf Of aishwarya selvaraj
Sent: Wednesday, December 21, 2016 12:52 PM
To: cmake@cmake.org
Subject: [CMake] Cmake

Hi Everyone,
Myself Aishwarya .I wanted to make use of Cmake , but I'm really new to this 
and doesn't have a clear idea about it.
1) My Goal :
I'm using Praat a speech Processing Software to create plug - in for my 
Algorithm on Pitch and Time scaling .(I have the .cpp file)
In order to do that I need to use the binary file obtained by compiling .cpp 
file
​in my Praat Script .
I intent to share this plug - in with others ,Hence I want it to be machine 
independent .The binary file I obtained is using gcc in Linux (16.0.2), which 
clearly wont work in Mac or Windows or even in lower Linux Version.
To solve this Problem I understand that I need to make use of Cmake files .
2) My .cpp file called TSM_CODE_V3.cpp is compiled as
g++ TSM_CODE_V3.cpp -larmadillo -lsndfile -o TSM
where armadillo and sndfile are two depended libraries.

3) What I have done :
​I have gone through a loot of tutorials for cmake .I have wage idea , but I'm 
not able to solve my problem mentioned above .
​My folder TSM consists of
build - the folder which consists the final executable binary file and the 
related cmake files required to create binary file
src - consists of my TSM_CODE_V3.cpp code
CMakeLists.txt - The top level Cmake file :

         cmake_minimum_required(VERSION 2.8.9)
         project(directory_TSM)
         include_directories(include)
         file(GLOB SOURCES "src/*.cpp")
         add_executable(tsm ${SOURCES})

I need to include the library armadillo and lidsndfile .
I dont know how to include it into my cmakefile .
I have come across find_package ,find_library  but I am sure about it .
 To create my Praat Plug - in I need to compile the source code no matter in 
which system it is ,which may or may not have these two libraries already 
installed.
So how how do I add libraries using cmake ?
I hope you got my point .
Could help me ?

Hoping for your reply .

--
Regards,
Aishwarya Selvaraj
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to