我想用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