[CMake] building executable from static libs
Alexander Neundorf
a.neundorf-work at gmx.net
Wed Oct 11 11:00:52 EDT 2006
-------- Original-Nachricht --------
Datum: Wed, 11 Oct 2006 16:29:11 +0200
Von: Benjamin Roy <Benjamin.Roy at irisa.fr>
An: cmake at cmake.org
Betreff: [CMake] building executable from static libs
> Hi,
>
> My question should sound like a dummy one, but can't find the answer by
> myself, maybe I have not understand clearly the spirit of Cmake...
>
> I try to change a build system from automake/autoconf under Cmake on
> linux, due to some portability issues...
>
> So I need to build some executable from static library I build just
> before, actually I have this Chronology :
> 1-run Cmake in order to configure and create the make to build the
> static lib
> 2-run make to build the static library
> 3-re-run Cmake to update the make for the executable
> 4-run make to build the executable
>
> And i try to avoid the step 3 and 4 in order to generate a make that
> build directly the executable after build static lib without re-run Cmake.
>
> I try few solution based on test with IF or
> SET_SOURCE_FILES_PROPERTIES(... GENERATED ) or try to use dependencies
> and ADD_CUSTOM_TARGET/ADD_CUSTOM_COMMAND , but no one of this solutions
> is working fine.
>
> So I ask for possible solutions.
add_library(mystaticlib STATIC foo1.c foo2.c foo3.c)
add_executable(myprogram main.c)
target_link_libraries(myprogram mystaticlib)
$ cmake .
$ make
should work.
Doesn't it for you ?
Bye
Alex
--
GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist!
NEU: Jetzt bis zu 16.000 kBit/s! http://www.gmx.net/de/go/dsl
More information about the CMake
mailing list