I have a program built within CMake that generates some code. I need this generated code to compile some other libraries. The problem I'm having is setting the dependency of the generated source file to its compiler. This is what I have currently:

  # This is the helper compiler
  ADD_EXECUTABLE(ExtractSymbolsFromXML ExtractSymbolsFromXML.cc)
  TARGET_LINK_LIBRARIES(ExtractSymbolsFromXML Dataflow_Network)

  # Get the full path to the ExtractSymbolsFromXML executable
GET_TARGET_PROPERTY(ExtractSymbolsFromXML_exe ExtractSymbolsFromXML ${CMAKE_BUILD_TYPE}_LOCATION) # Get the path to the executable, so that I can stuff the generated file in the same place
  GET_FILENAME_COMPONENT(binary_path ${ExtractSymbolsFromXML_exe} PATH)
  SET(Loader_cc "${binary_path}/Loader.cc")
  SET_SOURCE_FILES_PROPERTIES(
    ${Loader_cc}
    PROPERTIES GENERATED TRUE
    )
  ADD_CUSTOM_COMMAND(
    OUTPUT ${Loader_cc}
    COMMAND ${ExtractSymbolsFromXML_exe} -o ${Loader_cc}
    # This is where I get hung up.
    MAIN_DEPENDENCY ${ExtractSymbolsFromXML_exe}
    COMMENT "Generating static loader file: ${Loader_cc}"
    )

  ADD_LIBRARY(StaticHelper Loader.h ${Loader_cc})

==================================================================
I can't seem to get the dependency for ${Loader_cc} right. Any ideas of what I'm doing wrong?

Thanks,
James
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to