[CMake] cmake / xcode / c++ header files

Michael Jackson mike.jackson at bluequartz.net
Tue Nov 22 09:29:55 EST 2011


I have my own macro that I use for this:


MACRO (cmp_IDE_SOURCE_PROPERTIES SOURCE_PATH HEADERS SOURCES INSTALL_FILES)
    if (${INSTALL_FILES} EQUAL "1")
        INSTALL (FILES ${HEADERS}
                 DESTINATION include/${SOURCE_PATH}
                 COMPONENT Headers           
        )
    endif()
    STRING(REPLACE "/" "\\\\" source_group_path ${SOURCE_PATH}  )
    source_group(${source_group_path} FILES ${HEADERS} ${SOURCES})

  #-- The following is needed if we ever start to use OS X Frameworks but only
  #--  works on CMake 2.6 and greater
  #set_property(SOURCE ${HEADERS}
  #             PROPERTY MACOSX_PACKAGE_LOCATION Headers/${NAME}
  #)

ENDMACRO (cmp_IDE_SOURCE_PROPERTIES NAME HEADERS SOURCES INSTALL_FILES)

And I use it like this:

cmp_IDE_SOURCE_PROPERTIES( "include" "${${this_target}_HEADER_FILES}" "${this_target}_SOURCE_FILES" TRUE)

This seems to need CMake 2.8.6 to really work well.

--
Mike Jackson <www.bluequartz.net>

On Nov 22, 2011, at 8:42 AM, g4 at novadsp.com wrote:

> How can I get the cmake xcode generator to add a /include folder to generated projects? The cmakelists contain these directives:
> 
> SET(${this_target}_HEADER_FILES ./a.h ./b.h)
> SET_SOURCE_FILES_PROPERTIES(${this_target}_HEADER_FILES PROPERTIES HEADER_FILE_ONLY TRUE)
> LIST(APPEND ${this_target}_SOURCE_FILES ${${this_target}_HEADER_FILES})
> 
> Thx++
> 
> 
> --
> 
> 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



More information about the CMake mailing list