CMAKE Watch Issues

I use CMAKE to generate VS2008 SLN / VCPROJ files, but a few simple things do not work:

1) This works: INCLUDE_DIRECTORIES ($ENV{MCS_OGRE_HOME}/OgreMain/include)

But this is not so, my VC ++ additionally includes dirs, which is completely confused when I do this, brackets and all kinds of floating around:

SET (OGRE_PATH $ENV{OGRE_HOME}/OgreMain)
INCLUDE_DIRECTORIES (${OGRE_PATH}/include)

2) This works: target_link_libraries( debug $ENV{OGRE_HOME}/lib/OgreMainStatic_d.lib )

But this is not so, the library path is not displayed along the library path in VC ++:

LINK_DIRECTORIES($ENV{OGRE_HOME}/lib/)
target_link_libraries( debug OgreMainStatic_d.lib )

I suppose this should be something simple?

0
source share
1 answer

Instead

set(OGRE_PATH $ENV{OGRE_HOME}/OgreMain)

Using:

string(REPLACE "\\" "/" OGRE_PATH "$ENV{OGRE_HOME}/OgreMain")

CMake uses all the "/" for path separators on all platforms.

, ( "/" ) target_link_libraries, link_directories. CMake .

: , "debug" target_link_libraries. ? , ?

- :

target_link_libraries(mylib
  debug /path/to/DebugLib.lib
  optimized /path/to/ReleaseLib.lib)
+1

Source: https://habr.com/ru/post/1796095/


All Articles