Hi 

As mentioned before, I am replacing a manually built gnu makefile (for Linux) 
that builds a library, with CMake.

A required build step is to run an executable called versionInfo that processes 
all the source files of the library and generates a new source file called 
SourceFileInfo.cpp. This generated file must be compiled and added to the 
library. This step must be executed when any library dependency changes (i.e. 
any other source file changes).

I tried:

add_custom_command (
  TARGET Kernel
  PRE_BUILD
  COMMAND ${CMAKE_SOURCE_DIR}/../VersionInfo/versionInfo ${CMAKE_SOURCE_DIR} 
KERNEL
  [COMMENT "Building SourceFileInfo.cpp"]
  )                    

add_library(Kernel STATIC
            ErrorHandler.cpp
            EnvVars.cpp
            SourceFileInfo.cpp
            <snip>
            )

The source files are compiled ok, but versionInfo does not run and, because 
SourceFileInfo.cpp is therefore not found, the script fails.

Am I on the right track?

I read that PRE_BUILD is only supported for Visual Studio 7 or later, but I got 
no better result with PRE_LINK.
 
Best regards

David
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to