[CMake] Two issues...

J Decker d3ck0r at gmail.com
Tue Apr 13 18:57:22 EDT 2010


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" )


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?


More information about the CMake mailing list