[CMake] Non existent / new file handling

Denis Scherbakov denis_scherbakov at yahoo.com
Fri Mar 13 13:15:47 EDT 2009


John,

You may want to look into ADD_CUSTOM_COMMAND.

====================
PROJECT(CORBASAMPLE)

ADD_CUSTOM_COMMAND(
  OUTPUT "${PROJECT_BINARY_DIR}/MyMicoGeneratedSource.cpp"
  COMMAND "${MICO_IDL_EXECUTABLE}" --hh-suffix=hh --any --poa ${PROJECT_SOURCE_DIR}/IdlSource.idl)

SET_SOURCE_FILES_PROPERTIES(
  "${PROJECT_BINARY_DIR}/MyMicoGeneratedSource.cc"
  "${PROJECT_BINARY_DIR}/MyMicoGeneratedSource.hh"
  PROPERTIES
  GENERATED TRUE
)

SET (CORBASAMPLE_SRCS
     ${PROJECT_BINARY_DIR}/MyMicoGeneratedSource.cc

     MyNormalSource.cc
     MyOtherSource.cc
     OneMoreSource.cc
)

INCLUDE_DIRECTORIES(
)

ADD_LIBRARY(CorbaSample STATIC ${CORBASAMPLE_SRCS})
====================
[ 25%] Generating MyMicoGeneratedSource.cc
Scanning dependencies of target CorbaSample
[ 50%] Building CXX object CorbaSample/CMakeFiles/CorbaSample.dir/MyNormalSource.cc.o
[ 75%] Building CXX object CorbaSample/CMakeFiles/CorbaSample.dir/MyOtherSource.cc.o
[100%] Building CXX object CorbaSample/CMakeFiles/CorbaSample.dir/OneMoreSource.cc.o
Linking CXX static library libCorbaSample.a
[100%] Built target CorbaSample

Denis


      


More information about the CMake mailing list