[CMake] How to substitute zero in a variable

Eric (Brad) Lemings brad at rebit.com
Wed Sep 24 16:12:08 EDT 2008


Consider the following:

CMakeLists.txt:
    set (ZERO 0)
    configure_file (
            ${CMAKE_SOURCE_DIR}/include/config.h.cmake
            ${CMAKE_BINARY_DIR}/include/config.h
    )

${CMAKE_SOURCE_DIR}/include/config.h.cmake:
    #cmakedefine ZERO @ZERO@

When I run cmake, I get the following header file:

${CMAKE_BINARY_DIR}/include/config.h:
    #define ZERO

How do I coax CMake to get the literal integer constant '0' replaced for
@ZERO@?

Thanks.



More information about the CMake mailing list