Search code examples
cmakenmakefile-conversion

Is there a conversion utility for converting NMAKE build files to CMAKE build files?


Or are you all laughing so hard that you can't type a response? :)

Bottom line is that one library we're using (GDAL) has an NMAKE build file that we'd like to incorporate into our CMAKE build process. But maybe NMAKE and CMAKE are apples and oranges?


Solution

  • Basic idea is to chain the second build system from the first.

    In CMake:

    Use something like

    add_custom_command(
        OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/nmake-target.dll
        COMMAND nmake
        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Makefile
    )
    

    http://www.cmake.org/cmake/help/cmake2.6docs.html#command:add_custom_command

    In SCons:

    Use something like

    env.Command ('nmake-target.dll', null, 'nmake')

    http://scons.org/doc/2.1.0.alpha.20101125/HTML/scons-user/c3778.html