[CMake] Linking with a Shell Script
Michael Hertling
mhertling at online.de
Sat Oct 23 10:33:47 EDT 2010
On 10/22/2010 09:21 PM, Bob Torgerson wrote:
> To Whom It May Concern:
>
> We have a shell script available on our system that is used in the common
> linking stage of making a set of executables that we would like to use for
> in CMake. We are not entirely certain how this can be done outside of
> possibly passing a set of command line options to a custom target that would
> use that shell script. The script is used to gather a set of libraries [...]
Although I don't know what your script does exactly - e.g., does it
drive the entire linking stage or does it just return the names of
libraries to link against, like pkg-config - I could imagine the
following alternatives:
1) Use EXECUTE_PROCESS() to execute your script at configuration time
and put the results in a TARGET_LINK_LIBRARIES() invocation or the
LINK_FLAGS target properties. IMO, the former should be preferred.
2) With Makefile generators: Use the RULE_LAUNCH_LINK global/target/
directory property to integrate your script in the linking stage.
2) Modify the CMAKE_<LANG>_LINK_EXECUTABLE variables locally in the
directories of the concerned targets for the same purpose.
> [...] that
> belong to a third party package.
Perhaps, you might consider to turn your script into a find module for
the third party package, so you can use FIND_PACKAGE() to obtain the
libraries that package provides.
Regards,
Michael
More information about the CMake
mailing list