[CMake] Cmake
Stuermer, Michael SP/HZA-ZSEP
michael.stuermer at schaeffler.com
Wed Dec 21 07:04:13 EST 2016
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-bounces at cmake.org] On Behalf Of aishwarya selvaraj
Sent: Wednesday, December 21, 2016 12:52 PM
To: cmake at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20161221/9ca97e62/attachment.html>
More information about the CMake
mailing list