2
庫當然這是一個的CMake很基本的問題,...CMake的與一個單一的.h文件中
我不知道,如果有可能,或者如果它有必要創建類似靜態庫:libhelloword。一個 從一個cpp代碼的單個.h文件。
我寫的CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
SET(LIB_HELLOWORLD "helloworld")
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
)
ADD_LIBRARY(${LIB_HELLOWORLD} STATIC
helloworld.h
)
不幸的是這是行不通的。
我得到
-- Configuring done
CMake Error at CMakeLists.txt:12 (ADD_LIBRARY):
Cannot find source file:
helloworld.h
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx
-- Build files have been written to: /path/to/files
,我不能運行make因爲沒有生成文件創建
任何幫助,將不勝感激,因爲我失去了在這個cmake的世界:P
BTW:該.h文件是一個外部庫(當然)我無法修改。
什麼是您的文件結構是什麼樣子? –
創建僅標頭靜態庫有什麼意義? '.h文件是一個外部庫'你的意思是你有外部已經建立的庫和'helloworld.h'是接口頭? – 2013-11-29 08:51:10