[CMake] Two issues...

James Bigler jamesbigler at gmail.com
Tue Apr 13 23:08:37 EDT 2010


On Tue, Apr 13, 2010 at 4:57 PM, J Decker <d3ck0r at gmail.com> wrote:

> There's no way to set properties like LANGUAGE on files in a library
> seperatly if those files are used in another library also...
>
> PROJECT( project1 )
> ADD_EXECUTABLE( ${PROJECT_NAME} sourcefile.c )
> GET_TARGET_PROPERTY(SOURCES ${PROJECT_NAME} SOURCES)
> set_source_files_properties( ${SOURCES} PROPERTIES LANGUAGE "CXX" )
>
>
> PROJECT( project2 )
> ADD_EXECUTABLE( ${PROJECT_NAME} sourcefile.c )
> GET_TARGET_PROPERTY(SOURCES ${PROJECT_NAME} SOURCES)
> set_source_files_properties( ${SOURCES} PROPERTIES LANGUAGE "C" )
>
>
I think that would work if you ran the two commands from CMakeLists.txt
files that were in separate directories (i.e. different directory scopes).


>
> Also, there's no way to just get the list of target outputs that a
> executable or library was linked with?
>
> TARGET_LINK_LIBRARIES( ${PROJECT_NAME} libxyz )
>
> I tried to use
>
>
>  GET_TARGET_PROPERTY(LIBS2 ${proj} IMPORTED_LINK_INTERFACE_LIBRARIES )
>  message( "libs: ${LIBS2}" )
>  GET_TARGET_PROPERTY(LIBS ${proj} IMPORTED_LINK_DEPENDENT_LIBRARIES )
>  message( "libs: ${LIBS}" )
>
> but the results are LIBS-NOTFOUND and LIBS2-NOTFOUND ....
>
> This CMAKE installation steps seem to be unix-centric, in expecting to
> target a consistant /usr/local/bin or /usr/bin etc for installation
> targets.   This particular tree that I'm slowly migrating actually has
> about a dozen individual targets, and each final installation needs to
> include the program itslef, maybe some data associated with it and all
> of the libraries it requires to link.  Each product needs to be self
> contained, and I would think that cmake would have the target names of
> all products built available that I could just get that list to copy
> all of those into a final installation directory?
>

One thing to keep in mind is that the INSTALL(TARGETS) command needs to be
called from the same directory the target is is defined.

The IMPORTED_* properties don't apply to targets that were built by CMake,
but rather targets whose information was imported from another project (see
the install(EXPORT) command documentation).

Outside of that, I'm not sure how to get the list of dependent targets from
a target.

James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100413/5a54e7fc/attachment.htm>


More information about the CMake mailing list