views:

36

answers:

0

I want to generate a Eclipse CDT project with CMake where the resulting Eclipse project contains the defined build types as selectable build configurations from within the IDE.

For example:

if(CMAKE_CONFIGURATION_TYPES)
   set(CMAKE_CONFIGURATION_TYPES PRODUCT_A PRODUCT_B)
   set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING
     "Reset the configurations to what we need"
     FORCE)
 endif()

SET(CMAKE_C_FLAGS_PRODUCT_A
    "-DF_ENABLE_FEATURE_A -DF_ENABLE_FEATURE_B
    )

SET(CMAKE_C_FLAGS_PRODUCT_B
    "-DF_ENABLE_FEATURE_A
    )

Using the above approach, a Visual Studio project generator gives me build configuriatons to select product_A product_B and highlights the active code correctly.

If however I generate a Eclipse project the build configuration isn't there.

How do I get this to work for Eclipse projects?