Re: [CMake] Link step more than once

2014-09-11 Thread Robert Maynard
Are you trying to generate two different libraries from the same target? On Thu, Sep 11, 2014 at 10:45 AM, fungos fun...@gmail.com wrote: Hi, How can I create two linker steps with different flags for the same target at the same build? Example: target: X link: linker.exe libs_for_a

Re: [CMake] Link step more than once

2014-09-11 Thread fungos
Yes, we can say that.. in reality I need two outputs for a single target, but these outputs are generated almost exactly with just 2 different linker flags removed. On Thu, Sep 11, 2014 at 11:31 AM, Robert Maynard robert.mayn...@kitware.com wrote: Are you trying to generate two different

Re: [CMake] Link step more than once

2014-09-11 Thread Robert Maynard
Generally the easiest way is to have two targets that share the same source files but have different linker flags. On Thu, Sep 11, 2014 at 12:53 PM, fungos fun...@gmail.com wrote: Yes, we can say that.. in reality I need two outputs for a single target, but these outputs are generated almost

Re: [CMake] Link step more than once

2014-09-11 Thread fungos
Ok, but will this _recompile_ the sources for each target? We must use the same generated object files for the two outputs, the only difference must be the linker flags. On Thu, Sep 11, 2014 at 1:20 PM, Robert Maynard robert.mayn...@kitware.com wrote: Generally the easiest way is to have two

Re: [CMake] Link step more than once

2014-09-11 Thread Chuck Atkins
Sounds like what you want is an object library, http://www.cmake.org/Wiki/CMake/Tutorials/Object_Library: set(FOO_SOURCES Foo1.cxx Bar2.cxx FooBar3.cxx ) add_library(FooObjLib OBJECT ${FOO_SOURCES}) add_executable(A $TARGET_OBJECTS:FooObjLib) set_target_properties(A PROPERTIES LINK_FLAGS

Re: [CMake] Link step more than once

2014-09-11 Thread fungos
Cool, this did the trick. It was needed a post-build step to rename the target but it works. Thank you On Thu, Sep 11, 2014 at 2:19 PM, Chuck Atkins chuck.atk...@kitware.com wrote: Sounds like what you want is an object library, http://www.cmake.org/Wiki/CMake/Tutorials/Object_Library:

Re: [CMake] Link step more than once

2014-09-11 Thread Robert Maynard
Set the OUTPUT_NAME or OUTPUT_NAME_CONFIG property on the target to change what the name of the generated library will be. This will eliminate the need for a post-build step. On Thu, Sep 11, 2014 at 4:16 PM, fungos fun...@gmail.com wrote: Cool, this did the trick. It was needed a post-build step