<div dir="auto"><div>No, setting a variable in cmake is done with the 'set(GSL_ROOT /path/to/gsl)' command.<div dir="auto"><br></div><div dir="auto">You can alternatively set a similarly named environment variable when invoking cmake:</div><div dir="auto"><br></div><div dir="auto">GSL_ROOT="/path/to/gsl" cmake <path to source dir></div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 25, 2019, 05:15 Sachithra Weerasooriya <<a href="mailto:sachiwee@gmail.com">sachiwee@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"> I did install it in a non standard path. Which is why was trying to figure out how to link gsl. I couldn’t use homebrew since I don’t have root permissions on the machine. Do you just edit the text file just before calling find_package statement like this ?<div>GSL_ROOT_DIR=\path\to\gsl<div><br></div><div>Thanks!</div><div>Best regards,</div><div>Sachi<br><br><div dir="ltr"><br></div><div dir="ltr"><br>On Sep 24, 2019, at 3:08 PM, Avraham Shukron <<a href="mailto:avraham.shukron@gmail.com" target="_blank" rel="noreferrer">avraham.shukron@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div dir="ltr"><div dir="ltr">The macro looks fine (assuming you actually call it somewhere).<div>And I also assume that the line that fails is the find_package(GSL REQUIRED)</div><div><br></div><div>I suspect that it fails because you installed GSL in a local directory that is not in a location known to cmake (E.g not in /usr/local/lib or something similar)</div><div><br></div><div>Can you specify the path you installed GSL to?</div><div><br></div><div>In order for CMake to find package in a non-standard location, you can set the <a href="https://cmake.org/cmake/help/latest/variable/PackageName_ROOT.html#packagename-root" target="_blank" rel="noreferrer">GSL_ROOT</a> cmake variable before calling find_package(GSL).<br></div><div>You should set it to wherever you installed the GSL library locally.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 24, 2019 at 9:37 PM Sachithra Weerasooriya <<a href="mailto:sachiwee@gmail.com" target="_blank" rel="noreferrer">sachiwee@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Hi Avraham!<div>I installed GSL manually using in a local directory. OS version is macOS Mojave 10.14.5. Here's part of the file that looks for gsl:</div><div><div>#</div><div># How we find GSL and set it up</div><div>#</div><div>macro(find_gsl)</div><div><span style="white-space:pre-wrap"> </span>find_package(GSL REQUIRED)</div><div><span style="white-space:pre-wrap"> </span>list(APPEND VR_INCLUDE_DIRS ${GSL_INCLUDE_DIRS})</div><div><span style="white-space:pre-wrap"> </span>list(APPEND VR_LIBS ${GSL_LIBRARIES})</div><div>endmacro()</div><div><br></div><div>#</div></div><div><br></div><div>Thank you!</div><div>Best Regards,</div><div>Sachi</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 24, 2019 at 1:08 PM Avraham Shukron <<a href="mailto:avraham.shukron@gmail.com" target="_blank" rel="noreferrer">avraham.shukron@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Sachi!<div><br></div><div>Could you paste a minimal CMakeLists.txt file that demonstrate the problem, along with details about your OS version and how did you install GSL?</div><div><br></div><div>Thanks!</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 24, 2019 at 7:55 PM Raymond Wan <<a href="mailto:rwan.work@gmail.com" target="_blank" rel="noreferrer">rwan.work@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Sachi and everyone,<br>
<br>
Sorry, I didn't realise her original message wasn't CC'ed to the list.<br>
Please keep replies to the list, Sachi, unless there's a good reason<br>
you shouldn't. It will also allow someone to jump in if I've said<br>
something incorrectly about your problem.<br>
<br>
Ray<br>
<br>
<br>
---------- Forwarded message ---------<br>
From: Raymond Wan <<a href="mailto:rwan.work@gmail.com" target="_blank" rel="noreferrer">rwan.work@gmail.com</a>><br>
Date: Wed, Sep 25, 2019 at 12:52 AM<br>
Subject: Re: [CMake] Linking GSL to cmake using command line<br>
To: Sachithra Weerasooriya <<a href="mailto:sachiwee@gmail.com" target="_blank" rel="noreferrer">sachiwee@gmail.com</a>><br>
<br>
<br>
Hi Sachi,<br>
<br>
Then, to be frank, it's not something that CMake's users can help you<br>
with. It's (most probably) how the developer is using CMake to look<br>
for GSL and you should be contacting him/her. Generally, the end user<br>
of program X shouldn't have to learn about CMake. (Of course, no one<br>
is stopping you from learning.) The developer should be trying to fix<br>
it, unless you happen to already be an expert on CMake.<br>
<br>
If the developer isn't very responsive to your query, then that's a<br>
separate issue, that's also not related to CMake... S/he might be<br>
happy to hear from you since it's a bug report and it can only make<br>
program X better...I think?<br>
<br>
Ray<br>
<br>
On Wed, Sep 25, 2019 at 12:38 AM Sachithra Weerasooriya<br>
<<a href="mailto:sachiwee@gmail.com" target="_blank" rel="noreferrer">sachiwee@gmail.com</a>> wrote:<br>
><br>
> Hi Ray!<br>
> Thank you for your prompt reply! I appreciate it. Actually I am trying to install a package that uses cmake. Although GSL is installed in my machine, cmake can’t find the GSL directory.<br>
><br>
> Best regards,<br>
> Sachi<br>
><br>
><br>
><br>
> Sent from my iPhone<br>
><br>
> > On Sep 24, 2019, at 11:28 AM, Raymond Wan <<a href="mailto:rwan.work@gmail.com" target="_blank" rel="noreferrer">rwan.work@gmail.com</a>> wrote:<br>
> ><br>
> > Hi Sachi,<br>
> ><br>
> > Unfortunately, the short answer is "no". I think you misunderstand<br>
> > what CMake is. One way to summarise it is that it allows developers<br>
> > of programs to describe/explain how to compile and link software. For<br>
> > example, suppose there is a program X and it uses the GSL library. A<br>
> > programmer might use CMake to explain how GSL can link with X on Mac,<br>
> > Linux, etc. -- across various platforms. This will make it easier for<br>
> > the end user.<br>
> ><br>
> > If you are an end user (i.e., you didn't make the program X), then you<br>
> > need CMake isn't for you. I'm afraid you might have to read the GSL<br>
> > documentation for Mac, instead. If you are the developer of X, then<br>
> > you might want to go through the various CMake tutorials and give it a<br>
> > try -- then, if you're still stuck, post what you got so far so that<br>
> > someone can help you.<br>
> ><br>
> > Based on what you've asked, my guess is that CMake isn't what you<br>
> > should be looking into.<br>
> ><br>
> > Ray<br>
> ><br>
> > On Wed, Sep 25, 2019 at 12:22 AM Sachithra Weerasooriya<br>
> > <<a href="mailto:sachiwee@gmail.com" target="_blank" rel="noreferrer">sachiwee@gmail.com</a>> wrote:<br>
> >><br>
> >> Hi CMake community!<br>
> >> I am having trouble linking GSL to cmake using command line. I am using a Mac. Can someone please help me?<br>
> >><br>
> >> Thank you!<br>
> >> Best regards,<br>
> >> Sachi<br>
> >><br>
> >><br>
> >> --<br>
> >><br>
> >> Powered by <a href="http://www.kitware.com" rel="noreferrer noreferrer" target="_blank">www.kitware.com</a><br>
> >><br>
> >> Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
> >><br>
> >> Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
> >><br>
> >> CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
> >> CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
> >> CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
> >><br>
> >> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
> >><br>
> >> Follow this link to subscribe/unsubscribe:<br>
> >> <a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer noreferrer" target="_blank">https://cmake.org/mailman/listinfo/cmake</a><br>
-- <br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer noreferrer" target="_blank">https://cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</div></blockquote></div></div></div></blockquote></div></div></div>