[CMake] TARGET_LINK_LIBRARIES got a link error

Lloyd lloydkl.tech at gmail.com
Sat Apr 13 03:04:44 EDT 2013


On Sat, Apr 13, 2013 at 1:04 AM, Alexander Neundorf <a.neundorf-work at gmx.net
> wrote:

> On Friday 12 April 2013, Lloyd wrote:
> > Hi,
> >
> > I am new to Cmake and at present exploring its features for migrating our
> > projects build system to use it.
> >
> > I have main source folder inside that another folder contains the source
> > for our custom library.
> >
> > I understand that the problem is with my cmake file. Through that the
> > generated project cannot locate the location of my library build
> location.
> > What is the right way to solve this kind of problem?
> >
> > Thanks,
> >   Lloyd
> >
> > As a sample I am including my Cmake code
> >
> > #Cmake file of library source code
> > #Path-> Myproject/src/lib/reverse
> >
> > cmake_minimum_required (VERSION 2.6)
> >
> > if(WIN32)
> > SET (REV_SRC reverse.cpp reverse.h)
> > else(WIN32)
> > SET (REV_SRC reverse.cpp)
> > endif(WIN32)
> >
> > ADD_DEFINITIONS(-DREVERSE_EXPORTS)
>
> Just some nitpicking: I'd recommend to start writing also the cmake files
> in
> good style, i.e. with proper indentation and consistent upper- or lower
> casing.
> Also, if there are no strong reasons against it, I'd recommend to require a
> higher version of cmake, at least 2.8.0, better 2.8.3 or newer. This will
> give
> you more features and bug fixes, braces in if()-conditions.
> Then this code would look like:
>
> cmake_minimum_required (VERSION 2.8)
>
> if(WIN32)
>   set(REV_SRC reverse.cpp reverse.h)
> else()
>   set (REV_SRC reverse.cpp)
> endif()
>
> add_definitions(-DREVERSE_EXPORTS)
>
>
> Alex
>

Thank you Alex, My system already had cmake 2.6, that is why I chose that.
And again thanks for your style guide.

Lloyd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130413/e376218f/attachment.htm>


More information about the CMake mailing list