I just use include_directories( ... ) LINK_DIRECTORIES( ...} ) which works fine for specifying additional directories for that project and all sub projects included.
On Mon, Jan 16, 2012 at 7:24 AM, <hellho...@binary-revolution.org> wrote: > I use CMake to generate a Visual Studio 2010 project and solution file. > Actually I could set different settings, like warning level, incremental > building flag ect. from CMake. But I can't set additional includes and > libraries, listed in the VC++ Directory configuration tab. > > For GCC projects anything is running fine and I could compile and link the > project. For MSVC I've > to add those directories manually to perform a compile and link. But this is > stupid and boring... > > I tried to set the following CMake variables: > > INCLUDE_DIRECTORIES > LINK_DIRECTORIES > CMAKE_INCLUDE_PATH > > but nothing happend. If i open the project, the additional include directory > of the solution is always empty (only standard MSVE settings are given). I > tired to set this variables after executable creation, but this has also no > effect. > > I also tried to set the MSVC environment variables INCLUDE and PATH with > SET(ENV${PATH} "c:\test\...\") but this also has no effect. The directories > of the MSVC solution are empty. > > This is what i do directly in the header of the cmake file: > > CMAKE_MINIMUM_REQUIRED(VERSION 2.6) > PROJECT(${MODULE_NAME}) > IF (MSVC) > # Activate C++ exception handling > IF (NOT CMAKE_CXX_FLAGS MATCHES "/EHsc") > SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") > ENDIF () > > # Set Warning level always to 4 > IF (CMAKE_CXX_FLAGS MATCHES "/W[0-4]") > string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") > ELSE () > set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") > ENDIF () > > #read path of dependency modules > file(READ "msvc.deps" MSVC_PROPERTIES) > STRING(REGEX REPLACE ";" "\\\\;" MSVC_PROPERTIES "${MSVC_PROPERTIES}") > STRING(REGEX REPLACE "\n" ";" MSVC_PROPERTIES "${MSVC_PROPERTIES}") > > FOREACH(e ${MSVC_PROPERTIES}) > SET(INCLUDE ${INCLUDE} ${e}) > MESSAGE(STATUS "[INFO]: Value ${e}") > ENDFOREACH(e) > INCLUDE_DIRECTORIES(${INCLUDE}) > ENDIF () > > In the .deps file I've added to path of my dependeny modules, line separated: > > c:\binrev\development\boost\1.47\includes > c:\binrev\repository\modules\brCore\trunk\includes > > Both are read successfully but couldn't be set as additional include > directory in my MSVC solution. > > Best regards, Hellhound > > > > > -- > > 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 -- 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