Jump to content


How to add CMake includes and libraries to Visual Studio Solution ?


2 replies to this topic

#1 hellhound_01

    New Member

  • Members
  • PipPip
  • 58 posts

Posted 15 January 2012 - 02:39 PM

Hi,

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. Actually I've to set up those directories manually. This is stupid
and boring...

I tried to set the following CMake variables: CMAKE_INCLUDE_PATH, INCLUDE_DIRECTORY
but nothing happend. If i open the project, the additional include directory is always empty (only standard
MSVE settings are given).

I also tired to set this variables after executable creation, but this has also no effect.

Knows anyone how I could perform those settings at the solution using CMake?
Thanks for any help.

Best regards,
Hellhound
"There is only one god and his name is death. And there is only one thing we have to say to Death: Not today!" -- Syrio Forel (from Game of Thrones)

#2 Cybernator

    New Member

  • Members
  • Pip
  • 1 posts

Posted 16 January 2012 - 04:39 PM

You can add additional include directories using the include_directories command (as opposed to variable). As for library directories, I believe the right way to go is using find_library.The only trouble is that you may need to write additional search modules if the library you need to use is not supported. Another option is to add additional cached variables where you can set the paths to your libraries. Or, if you keep the libraries packaged with the source code, perhaps you could link the libraries using paths relative to CMAKE_SOURCE_DIR.

Hope this helps.

#3 hellhound_01

    New Member

  • Members
  • PipPip
  • 58 posts

Posted 16 January 2012 - 08:50 PM

You are right INCLUDE_DIRECTORIES and LINK_DIRECTORIES are the correct commands.
I've checked the wrong configuration tab of my project solution:

Quote

project properties--> Configurations --> VC++ Directories to check my includes

But it must be :

Quote

project properties --> Configurations --> C++ --> General ...

"There is only one god and his name is death. And there is only one thing we have to say to Death: Not today!" -- Syrio Forel (from Game of Thrones)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users