[CMake] Fwd: Linking GSL to cmake using command line

Avraham Shukron avraham.shukron at gmail.com
Wed Sep 25 01:12:36 EDT 2019


No, setting a variable in cmake is done with the 'set(GSL_ROOT
/path/to/gsl)' command.

You can alternatively set a similarly named environment variable when
invoking cmake:

GSL_ROOT="/path/to/gsl" cmake <path to source dir>


On Wed, Sep 25, 2019, 05:15 Sachithra Weerasooriya <sachiwee at gmail.com>
wrote:

>  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 ?
> GSL_ROOT_DIR=\path\to\gsl
>
> Thanks!
> Best regards,
> Sachi
>
>
>
> On Sep 24, 2019, at 3:08 PM, Avraham Shukron <avraham.shukron at gmail.com>
> wrote:
>
> The macro looks fine (assuming you actually call it somewhere).
> And I also assume that the line that fails is the find_package(GSL
> REQUIRED)
>
> 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)
>
> Can you specify the path you installed GSL to?
>
> In order for CMake to find package in a non-standard location, you can set
> the GSL_ROOT
> <https://cmake.org/cmake/help/latest/variable/PackageName_ROOT.html#packagename-root>
> cmake variable before calling find_package(GSL).
> You should set it to wherever you installed the GSL library locally.
>
> On Tue, Sep 24, 2019 at 9:37 PM Sachithra Weerasooriya <sachiwee at gmail.com>
> wrote:
>
>> Hi Avraham!
>> 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:
>> #
>> # How we find GSL and set it up
>> #
>> macro(find_gsl)
>> find_package(GSL REQUIRED)
>> list(APPEND VR_INCLUDE_DIRS ${GSL_INCLUDE_DIRS})
>> list(APPEND VR_LIBS ${GSL_LIBRARIES})
>> endmacro()
>>
>> #
>>
>> Thank you!
>> Best Regards,
>> Sachi
>>
>> On Tue, Sep 24, 2019 at 1:08 PM Avraham Shukron <
>> avraham.shukron at gmail.com> wrote:
>>
>>> Hi Sachi!
>>>
>>> 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?
>>>
>>> Thanks!
>>>
>>> On Tue, Sep 24, 2019 at 7:55 PM Raymond Wan <rwan.work at gmail.com> wrote:
>>>
>>>> Hi Sachi and everyone,
>>>>
>>>> Sorry, I didn't realise her original message wasn't CC'ed to the list.
>>>> Please keep replies to the list, Sachi, unless there's a good reason
>>>> you shouldn't.  It will also allow someone to jump in if I've said
>>>> something incorrectly about your problem.
>>>>
>>>> Ray
>>>>
>>>>
>>>> ---------- Forwarded message ---------
>>>> From: Raymond Wan <rwan.work at gmail.com>
>>>> Date: Wed, Sep 25, 2019 at 12:52 AM
>>>> Subject: Re: [CMake] Linking GSL to cmake using command line
>>>> To: Sachithra Weerasooriya <sachiwee at gmail.com>
>>>>
>>>>
>>>> Hi Sachi,
>>>>
>>>> Then, to be frank, it's not something that CMake's users can help you
>>>> with.  It's (most probably) how the developer is using CMake to look
>>>> for GSL and you should be contacting him/her.  Generally, the end user
>>>> of program X shouldn't have to learn about CMake.  (Of course, no one
>>>> is stopping you from learning.)  The developer should be trying to fix
>>>> it, unless you happen to already be an expert on CMake.
>>>>
>>>> If the developer isn't very responsive to your query, then that's a
>>>> separate issue, that's also not related to CMake...  S/he might be
>>>> happy to hear from you since it's a bug report and it can only make
>>>> program X better...I think?
>>>>
>>>> Ray
>>>>
>>>> On Wed, Sep 25, 2019 at 12:38 AM Sachithra Weerasooriya
>>>> <sachiwee at gmail.com> wrote:
>>>> >
>>>> > Hi Ray!
>>>> > 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.
>>>> >
>>>> > Best regards,
>>>> > Sachi
>>>> >
>>>> >
>>>> >
>>>> > Sent from my iPhone
>>>> >
>>>> > > On Sep 24, 2019, at 11:28 AM, Raymond Wan <rwan.work at gmail.com>
>>>> wrote:
>>>> > >
>>>> > > Hi Sachi,
>>>> > >
>>>> > > Unfortunately, the short answer is "no".  I think you misunderstand
>>>> > > what CMake is.  One way to summarise it is that it allows developers
>>>> > > of programs to describe/explain how to compile and link software.
>>>> For
>>>> > > example, suppose there is a program X and it uses the GSL library.
>>>> A
>>>> > > programmer might use CMake to explain how GSL can link with X on
>>>> Mac,
>>>> > > Linux, etc. -- across various platforms.  This will make it easier
>>>> for
>>>> > > the end user.
>>>> > >
>>>> > > If you are an end user (i.e., you didn't make the program X), then
>>>> you
>>>> > > need CMake isn't for you.  I'm afraid you might have to read the GSL
>>>> > > documentation for Mac, instead.  If you are the developer of X, then
>>>> > > you might want to go through the various CMake tutorials and give
>>>> it a
>>>> > > try -- then, if you're still stuck, post what you got so far so that
>>>> > > someone can help you.
>>>> > >
>>>> > > Based on what you've asked, my guess is that CMake isn't what you
>>>> > > should be looking into.
>>>> > >
>>>> > > Ray
>>>> > >
>>>> > > On Wed, Sep 25, 2019 at 12:22 AM Sachithra Weerasooriya
>>>> > > <sachiwee at gmail.com> wrote:
>>>> > >>
>>>> > >> Hi CMake community!
>>>> > >> I am having trouble linking GSL to cmake using command line. I am
>>>> using a Mac. Can someone please help me?
>>>> > >>
>>>> > >> Thank you!
>>>> > >> Best regards,
>>>> > >> Sachi
>>>> > >>
>>>> > >>
>>>> > >> --
>>>> > >>
>>>> > >> 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:
>>>> > >> https://cmake.org/mailman/listinfo/cmake
>>>> --
>>>>
>>>> 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:
>>>> https://cmake.org/mailman/listinfo/cmake
>>>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190925/6e02d444/attachment.html>


More information about the CMake mailing list