<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Title" content="">
<meta name="Keywords" content="">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:Calibri;
        color:windowtext;}
span.msoIns
        {mso-style-type:export-only;
        mso-style-name:"";
        text-decoration:underline;
        color:teal;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body bgcolor="white" lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">Hi there,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">If I’m not mistaken, when a library cannot be found, the value of the variable “ARMADILLO” will be set to “ARMADILLO-NOTFOUND”. So I think you need to adjust your test to:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">IF (${ARMADILLO} STREQUAL “ARMADILLO-NOTFOUND”)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">  # do what you want<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">ENDIF ()<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Calibri;color:black">The following links in the doc may be helpful:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Calibri;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Calibri;color:black">https://cmake.org/cmake/help/v3.7/command/find_library.html<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Calibri;color:black">https://cmake.org/cmake/help/v3.7/command/if.html<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Calibri;color:black"><br>
<b>Parag Chandra<br>
</b>Technical Lead, Mobile Team<br>
Mobile: +1.919.824.1410<br>
<br>
Ionic Security Inc.<br>
1170 Peachtree St. NE STE 400, Atlanta, GA 30309<o:p></o:p></span></p>
<table class="MsoNormalTable" border="0" cellpadding="0" style="background:white">
<tbody>
<tr>
<td nowrap="" style="padding:.75pt .75pt .75pt .75pt"></td>
<td nowrap="" valign="top" style="padding:.75pt .75pt .75pt .75pt"></td>
<td nowrap="" style="padding:.75pt .75pt .75pt .75pt"></td>
<td nowrap="" style="padding:.75pt .75pt .75pt .75pt"></td>
</tr>
<tr>
<td width="5" nowrap="" style="width:3.75pt;padding:.75pt .75pt .75pt .75pt"></td>
<td width="70" nowrap="" valign="top" style="width:52.5pt;padding:.75pt .75pt .75pt .75pt">
</td>
<td width="5" nowrap="" style="width:3.75pt;padding:.75pt .75pt .75pt .75pt"></td>
<td width="287" nowrap="" valign="top" style="width:215.25pt;padding:.75pt .75pt .75pt .75pt">
</td>
</tr>
</tbody>
</table>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-family:Calibri;color:black">From: </span>
</b><span style="font-family:Calibri;color:black">CMake <cmake-bounces@cmake.org> on behalf of aishwarya selvaraj <aishwaryaselvaraj1708@gmail.com><br>
<b>Date: </b>Wednesday, January 4, 2017 at 12:29 PM<br>
<b>To: </b>cmake <cmake@cmake.org><br>
<b>Subject: </b>[EXTERNAL]: [CMake] To include external libraries using Cmake<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">Hi , <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">I'm using Cmake to create binary files as it can give a way to build my  application that will successfully compile on different platforms .<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">I use :<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">Linux -14.04<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">Cmake - 2.8.12 <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">My .cpp code is called <a href="http://tsm_code_v3.cpp.it/" target="_blank">TSM_CODE_V3.cpp.It</a> depends on two external library files .1) armadillo 2) sndfile .<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:9.5pt;color:black">I scripted a CmakeLists.txt as follows :<br>
<br>
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)<br>
PROJECT(TSM2)<br>
<br>
FIND_LIBRARY(ARMADILLO armadillo)<br>
MESSAGE(STATUS "Armadillo Library location: " ${ARMADILLO})<br>
<br>
IF (NOT ARMADILLO_FOUND)<br>
include(ExternalProject)<br>
MESSAGE(STATUS "Armadillo not found in the system ,Trying to install armadillo...")<br>
ExternalProject_Add(armadillo<br>
  URL <a href="https://github.com/lsolanka/armadillo/archive/master.zip" target="_blank">https://github.com/lsolanka/armadillo/archive/master.zip</a><br>
  PREFIX ${CMAKE_CURRENT_BINARY_DIR}/armadillo-latest)<br>
ENDIF()<br>
<br>
FIND_LIBRARY(SNDFILE sndfile)<br>
MESSAGE(STATUS "Sndfile Library location: " ${SNDFILE})<br>
<br>
IF (NOT SNDFILE_FOUND)<br>
include(ExternalProject)<br>
MESSAGE(STATUS "Armadillo not found in the system ,Trying to install libsndfile...")<br>
ExternalProject_Add(sndfile<br>
  URL <a href="https://github.com/erikd/libsndfile/archive/master.zip" target="_blank">https://github.com/erikd/libsndfile/archive/master.zip</a><br>
  PREFIX ${CMAKE_CURRENT_BINARY_DIR}/sndfile-latest)<br>
ENDIF()<br>
<br>
ADD_EXECUTABLE(tsm ${PROJECT_SOURCE_DIR}/src/TSM_CODE_V3.cpp)<br>
TARGET_LINK_LIBRARIES(tsm ${ARMADILLO} ${SNDFILE})<br>
<br>
<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:9.5pt;color:black">I made use of ExternalProject_add to download the external libraries from the specified link address ,but when I try to compile the CmakeLists.txt , it throws an error
 of saying library not found .Basically , the external library is not downloaded from the specified link .<br>
<br>
<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">I'm not  sure where am I going wrong here .<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:9.5pt;color:black">Can anyone help me out ?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">Hoping to hear from you..<o:p></o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">-- <o:p></o:p></p>
<div>
<div>
<p class="MsoNormal">Regards,<br>
Aishwarya Selvaraj<o:p></o:p></p>
</div>
</div>
</div>
</div>
</body>
</html>