Greetings,
I am learning cmake.
I have a question on using add_library. in my project(learnCMAKE). The
latter has:-
---a) 2 source files file1.c file2.c
---b) the envar {CFLAGS} set
---c) need to generate libLearnCMAKE.so and libLearnCMAKE.a
---d) need to add preprocessor agruments
Hi
this three lines should do the job:
CMakeLists.txt:
project(learnCMAKE)
add_definitions(-DXXX -DYYY -DSAMPLE=5)
add_library(learnCMAKE file1.c file2.c)
To build static libraries:
mkdir bldStatic
cd bldStatic
cmake -DBUILD_SHARED_LIBS=off -DCMAKE_BUILD_TYPE=Release ..
make
cd ,,
To build shar
Hi again,
I'v forgotten the envar question in the mail before.
If you really want to set additional options from outside CMakeLists.txt you
can do this:
add_defintions($ENV{CFLAGS})
using $ENV{} you can access any environment variable.
On Saturday 06 November 2010 17:26:11 luxInteg wrote:
> Gr
On 11/06/2010 05:26 PM, luxInteg wrote:
> Greetings,
>
> I am learning cmake.
>
> I have a question on using add_library. in my project(learnCMAKE). The
> latter has:-
>
> ---a) 2 source files file1.c file2.c
> ---b) the envar {CFLAGS} set
> ---c) need to generate libLearnCMAKE.so an
On Saturday 06 November 2010 17:30:10 Michael Hertling wrote:
> On 11/06/2010 05:26 PM, luxInteg wrote:
> > Greetings,
> >
> > I am learning cmake.
> >
> > I have a question on using add_library. in my project(learnCMAKE).
> > The latter has:-
> >
> > ---a) 2 source files file1.c file2.c
On Saturday 06 November 2010 16:27:06 Gerhard Gappmeier wrote:
> Hi
>
> this three lines should do the job:
>
> CMakeLists.txt:
> project(learnCMAKE)
> add_definitions(-DXXX -DYYY -DSAMPLE=5)
> add_library(learnCMAKE file1.c file2.c)
>
> To build static libraries:
> mkdir bldStatic
> cd bldStati
On Saturday 06 November 2010 21:55:21 luxInteg wrote:
> On Saturday 06 November 2010 17:30:10 Michael Hertling wrote:
> > On 11/06/2010 05:26 PM, luxInteg wrote:
> > > Greetings,
> > >
> > > I am learning cmake.
> > >
> > > I have a question on using add_library. in my project(learnCMAKE).
> >
2010/11/7 luxInteg :
> I tried the following:-
>
> ADD_LIBRARY(LearnCMAKE-shared SHARED file1.c file2.c )
> ADD_LIBRARY(LearnCMAKE-static STATIC file1.c file2.c )
> SET(var "")
> FOREACH(var DINT DLONG)
> SET_SOURCE_FILES_PROPERTIES( file1.c file2.c
> PROPERTIES COMPILE_DEFINITIONS ${v
On Saturday 06 November 2010 23:08:29 Eric Noulard wrote:
> 2010/11/7 luxInteg :
> > I tried the following:-
> >
> > ADD_LIBRARY(LearnCMAKE-shared SHARED file1.c file2.c )
> > ADD_LIBRARY(LearnCMAKE-static STATIC file1.c file2.c )
> > SET(var "")
> > FOREACH(var DINT DLONG)
> >SET_SOURC
On Saturday 06 November 2010 23:08:29 Eric Noulard wrote:
>
> I think you cannot use **the same** file properties on a source file
> and expect CMake will compile the file twice for the same target.
> If you want to compile the same source file twice with different compile
> flags **FOR THE SAME
2010/11/8 luxInteg :
> On Saturday 06 November 2010 23:08:29 Eric Noulard wrote:
>
>>
>> I think you cannot use **the same** file properties on a source file
>> and expect CMake will compile the file twice for the same target.
>> If you want to compile the same source file twice with different comp
On Monday 08 November 2010 18:10:01 Eric Noulard wrote:
> 2010/11/8 luxInteg :
> > On Saturday 06 November 2010 23:08:29 Eric Noulard wrote:
> >> I think you cannot use **the same** file properties on a source file
> >> and expect CMake will compile the file twice for the same target.
> >> If you w
On Monday 08 November 2010 22:21:54 luxInteg wrote:
> ---
> set(RUN oddone.o file2.c file3.c )
> LIST CONTAINS(file2.c file3.c ${RUN})
> IF (contains )
> (--compile file2.c and file3.c into oddone.o )
> endif (contains)
> -
> advice on whether lists of othrwise is ap
2010/11/8 luxInteg :
>>
>> If you manipulate list have a look at the CMake builtin "LIST" command.
>
> I had a look at lists on this page
> http://www.cmake.org/Wiki/CMakeMacroListOperations
You should reallty use **builtin** list
http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:list
On Monday 08 November 2010 18:10:01 Eric Noulard wrote:
> > BUT
> > suppose I decide to set file1.c and file2.c as some variable "FILES"
> > and I want to use a preprocessor say DLONG
> > could I do the following?
> >
> > set(FILES file1.c file2.c )
> > SET_SOURCE_FILES_PROPERTIES(${FILES} P
15 matches
Mail list logo