Re: [CMake] How to add CMake includes and libraries to Visual Studio Solution?

2012-01-16 Thread J Decker
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


Re: [CMake] How to add CMake includes and libraries to Visual Studio Solution?

2012-01-16 Thread hellhound
Where did you define your INCLUDE_DIRECTORIES? I also tried to set an absolute
path instead of using the CMake list, same result. Nothing is set...

Here is the link to the complete cmake file:
http://binrevengine.svn.sourceforge.net/viewvc/binrevengine/modules/brGraphics/branches/hellhound-dev/CMakeLists.txt?revision=1039view=markup

The additional cmake scripts could be found here:
http://binrevengine.svn.sourceforge.net/viewvc/binrevengine/data/cmake/


 Original Message -
From: d3c...@gmail.com
To: hellho...@binary-revolution.org
Date: 16.01.2012 17:13:18
Subject: Re: [CMake] How to add CMake includes and libraries to Visual Studio 
Solution?


 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

Re: [CMake] How to add CMake includes and libraries to Visual Studio Solution?

2012-01-16 Thread John Drescher
 Where did you define your INCLUDE_DIRECTORIES? I also tried to set an absolute
 path instead of using the CMake list, same result. Nothing is set...

For me this works as well. Define  INCLUDE_DIRECTORIES anywhere above
the ADD_EXECUTABLE or ADD_LIBRARY and visual studio will use it.

-- 
John M. Drescher
--

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


Re: [CMake] How to add CMake includes and libraries to Visual Studio Solution?

2012-01-16 Thread hellhound
Hmm this is strange, INCLUDE_DIRECTORIES is used but no effect.
I try to set:

 INCLUDE_DIRECTORIES(C:/binrev/development/boost/1.47/)

But the additional directory entry of my MSVC solution holds only
the default settings:

$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;

Is there any chance that i could check if INCLUDE_DIRECORIES is
set correctly by CMake? Maybe the settings are truncated by visual
studio ..




- Original Message -
From: d3c...@gmail.com
To: e...@sf-mail.de
Date: 16.01.2012 19:15:50
Subject: Re: [CMake] How to add CMake includes and libraries to Visual Studio 
Solution?


 On Mon, Jan 16, 2012 at 10:08 AM, Rolf Eike Beer e...@sf-mail.de wrote:
 J Decker wrote:
 I just use
 include_directories( ... )
 
 This is right.
 
 LINK_DIRECTORIES( ...} )
 
 This is almost surely wrong. LINK_DIRECTORIES is only needed for very seldom
 special cases and only causes headache in all other cases.
 
 oh, what's the preferred method to specify the directory where the
 library is then?
 
 
 Eike
 --
 
 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




--

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


Re: [CMake] How to add CMake includes and libraries to Visual Studio Solution?

2012-01-16 Thread John Drescher
On Mon, Jan 16, 2012 at 2:44 PM,  hellho...@binary-revolution.org wrote:
 Hmm this is strange, INCLUDE_DIRECTORIES is used but no effect.
 I try to set:

  INCLUDE_DIRECTORIES(C:/binrev/development/boost/1.47/)

 But the additional directory entry of my MSVC solution holds only
 the default settings:

 $(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;

 Is there any chance that i could check if INCLUDE_DIRECORIES is
 set correctly by CMake? Maybe the settings are truncated by visual
 studio ..


Is the project being regenerated and reloaded after the change?

-- 
John M. Drescher
--

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


Re: [CMake] How to add CMake includes and libraries to Visual Studio Solution?

2012-01-16 Thread hellhound
Thanks for support. Anything is working fine as described by you.
I've only checked the wrong solution folders ...

- Original Message -
From: e...@sf-mail.de
To: cmake@cmake.org
Date: 16.01.2012 21:01:37
Subject: Re: [CMake] How to add CMake includes and libraries to Visual Studio 
Solution?


 hellho...@binary-revolution.org wrote:
 Hmm this is strange, INCLUDE_DIRECTORIES is used but no effect.
 I try to set:
 
  INCLUDE_DIRECTORIES(C:/binrev/development/boost/1.47/)
 
 Should be INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}), no? We have such a 
 shiny 
 FindBoost.cmake that does all the work for you ;)

Yes it should be and it is, this was only for simple test... 

 But the additional directory entry of my MSVC solution holds only
 the default settings:
 
 $(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include
 ;$(FrameworkSDKDir)\include;
 
 Is there any chance that i could check if INCLUDE_DIRECORIES is
 set correctly by CMake? Maybe the settings are truncated by visual
 studio ..
 
 You need to use INCLUDE_DIRECTORIES() before doing the ADD_SUBDIRECTORY(), 
 ADD_EXECUTABLE(), or ADD_LIBRARY() that should use it.
 
 Eike--
 
 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


Re: [CMake] How to add CMake includes and libraries to Visual Studio Solution?

2012-01-16 Thread J Decker
On Mon, Jan 16, 2012 at 10:21 AM, John Drescher dresche...@gmail.com wrote:
 On Mon, Jan 16, 2012 at 1:15 PM, J Decker d3c...@gmail.com wrote:
 On Mon, Jan 16, 2012 at 10:08 AM, Rolf Eike Beer e...@sf-mail.de wrote:
 J Decker wrote:
 I just use
 include_directories( ... )

 This is right.

 LINK_DIRECTORIES( ...} )

 This is almost surely wrong. LINK_DIRECTORIES is only needed for very seldom
 special cases and only causes headache in all other cases.

 oh, what's the preferred method to specify the directory where the
 library is then?


 I believe the full path on the target_link_libraries.

I think the problem with that is if built with gcc, then the full path
to the library is encoded and you can't load the library from the
library path, but only from where it was specified.


 John
--

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


Re: [CMake] How to add CMake includes and libraries to Visual Studio Solution?

2012-01-16 Thread Andreas Pakulat
On 16.01.12 21:03:20, J Decker wrote:
 On Mon, Jan 16, 2012 at 10:21 AM, John Drescher dresche...@gmail.com wrote:
  On Mon, Jan 16, 2012 at 1:15 PM, J Decker d3c...@gmail.com wrote:
  On Mon, Jan 16, 2012 at 10:08 AM, Rolf Eike Beer e...@sf-mail.de wrote:
  J Decker wrote:
  I just use
  include_directories( ... )
 
  This is right.
 
  LINK_DIRECTORIES( ...} )
 
  This is almost surely wrong. LINK_DIRECTORIES is only needed for very 
  seldom
  special cases and only causes headache in all other cases.
 
  oh, what's the preferred method to specify the directory where the
  library is then?
 
 
  I believe the full path on the target_link_libraries.
 
 I think the problem with that is if built with gcc, then the full path
 to the library is encoded and you can't load the library from the
 library path, but only from where it was specified.

Thats not correct. Runtime loading of libraries depends on the runtime linker
used, which is ld on Linux usually. And that one finds libraries by
checking its ld.so.conf, the LD_LIBRARY_PATH and a possibly-existing
RPATH/RUNPATH setting in the executable. On Windows the runtime-linker
looks through the PATH variable, in the directory where the executable
is and at a few system-places.

What you might refer to is CMake's support for RPATH/RUNPATH on Linux,
but this can be turned off, tuned so the path is relative to the
executable and the linker simply ignores that if it cannot find a
library at the specified place and falls back to the other two options.

Andreas

--

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