[CMake] Extra include/lib paths - multiple entries
Yngve Inntjore Levinsen
yngve.levinsen at gmail.com
Sun Nov 21 12:04:06 EST 2010
On Thursday 18 November 2010 12:00:52 Adam J Richardson wrote:
> On Wed, 17 Nov 2010 13:12:42 +0100
> Yngve Inntjore Levinsen <yngve.levinsen at gmail.com> wrote:
>
> > On Wednesday 17 November 2010 12:30:06 Adam J Richardson wrote:
> > > Is this a correct specification for multiple include/lib paths in
> > > environment variables? If not, what should I use instead? Sometimes
> > > it seems to work, other times not...
> > >
> > > CMAKE_INCLUDE_PATH=C:/Compilers/Includes;C:/Compilers/MinGW/include
> > > CMAKE_LIBRARY_PATH=C:/Compilers/Libs;C:/Compilers/MinGW/lib
> >
> > This is how I would write it:
> > INCLUDE_DIRECTORIES(C:/Compilers/Includes C:/Compilers/MinGW/include)
> > TARGET_LINK_LIBRARIES(<your binary file name> C:/Compilers/Libs
> > C:/Compilers/MinGW/lib)
> >
> > I mostly use *nix systems though, so I am not perfectly sure how to
> > get it correct on Windows..
>
> Thanks for the reply Yngve. I wasn't clear: I need to specify the paths
> in the environment, not the CMakeLists.txt file. I use mostly *nix too,
> so adding Win-specific bits to the CMakeLists.txt isn't acceptable.
>
> I'm guessing on the *nix buildslaves I would have env vars:
>
> CMAKE_INCLUDE_PATH=/usr/include:/usr/myfunkylib/include
> CMAKE_LIBRARY_PATH=/usr/lib:/usr/myfunkylib/lib
>
> using colons as separators rather than semicolons as on Windows.
>
> Right? Or not? Should I be using one or the other for both types of
> environment, since CMake is xplat? Or is my approach entirely wrong? I
> would like to use CMAKE_*_PATH since those are included automatically
> and I'm a lazy developer. ;)
>
Ah, OK. You could use if-sentences in cmakelists? I use that to include some specific osx/linux variations.
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
whatever I need to do for Linux only...
endif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
I am no expert using CMake myself, so I am probably not the best one to ask. In my head your approach seems reasonable. I am afraid this is the limit of my knowledge in this matter...
Cheers
Yngve
More information about the CMake
mailing list