我想用Visual Studio 2010/VC10和CMake创建一个库。CMake包含和源路径与Windows目录路径不一样
Windows的树不同于CMake项目树。问题是CMake不会在Visual Studio中创建带有头文件和源文件的foolib。
我无法更改库的树,因为它是一个拥有大量共享多个包含文件的库的旧代码。
root
|-'includes
| '-foo.h
|-'src
| '-libprojects
| | '-foolib
| | | '-bin
| | | '-project
| | | | '-mak100
| | | | '-CMakeLists01.txt
| | | '-src
| | | | '-CMakeLists02.txt
| | | | '-foo.cxx
的唯一的CMakeLists.txt有很多解释。
CMakeLists01.txt
cmake_minimum_required (VERSION 2.8)
cmake_policy (SET CMP0015 NEW)
project (foolib)
set (CMAKE_BUILD_TYPE Debug)
include_directories ("${PROJECT_SOURCE_DIR}/../../../../include")
# This dosen't works and CMake can't find the CMakeLists02.txt ???
add_subdirectory("${PROJECT_SOURCE_DIR}/../src")
CMakeLists02.txt
# CMakeLists02.txt
set (QueryHeader
"./../../../../include/foo.h")
set (QuerySources
"foo.cxx")
问:我怎样才能包括CMakeLists02.txt到CMakeLists01.txt与add_subdirectory()
这是一个批处理文件,如果有人测试它
#doCMake.cmd
@echo off
call "c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tool\vsvars32.bat"
mkdir mak100
cd mak100
cmake -G "Visual Studio 10" ..
cd ..
pause
我不明白你的问题,如果你发布了一个问题,我不明白你的问题。你愿意多解释一下你期望的和你实际得到的东西吗? – usr1234567
[CMAKE添加子目录不是真实目录上的子目录]的可能重复(http://stackoverflow.com/questions/7980784/cmake-add-sub-directory-which-is-not-sub-directory -on-real-directory) – LPs
@ago。你的权利! – post4dirk