Добавить файлы с помощью CMake

Сейчас я создаю динамическую библиотеку с помощью CMake, и проблема, с которой я сейчас сталкиваюсь, связана с добавлением файлов для библиотеки. Структура моего проекта следующая:

----src
|
thrid_party---boost_1_50_0----boost
|       ---   |        ----libs
|       ---   |        ---- | --- filesystem
|       ---   |        ---- | ---   |  ------src

Мой файл CMakeLists.txt находится в src каталог, и содержимое файла являются следующими:

cmake_minimum_required( VERSION 2.6 )
project (temp)
#build the third party library
include_directories( ${irisimp_SOURCE_DIR}/../third_party/boost_1_50_0)
set (boost_path
${irisimp_SOURCE_DIR}/../third_party/boost_1_50_0/libs)

set (BOOST_LIST
${boost_path}/filesystem/src/codecvt_error_category.cpp
${boost_path}/filesystem/src/operations.cpp
${boost_path}/filesystem/src/path.cpp
${boost_path}/filesystem/src/path_traits.cpp
${boost_path}/filesystem/src/portability.cpp
${boost_path}/filesystem/src/unique_path.cpp
${boost_path}/filesystem/src/utf8_codecvt_facet.cpp
${boost_path}/filesystem/src/windows_file_codecvt.cpp
${boost_path}/filesystem/src/windows_file_codecvt.hpp
)
add_library ( boost SHARED ${BOOST_LIST})

У меня нет проблем с запуском этого скрипта, однако выходной проект Visual Studio 10 не содержит все исходные файлы в ${boost_path}/filesystem/srcпапка. На самом деле хранится только windows_file_codecvt.cpp. Поэтому компиляция этого проекта не удастся. Мне было интересно, что я должен сделать, чтобы проект Visual Studio 10 мог содержать все исходные файлы, как указано в CMakeLists.txt.Thanks!

2

Решение

Попробуйте поставить точку с запятой между путями следующим образом:

set (BOOST_LIST
${boost_path}/filesystem/src/codecvt_error_category.cpp;
${boost_path}/filesystem/src/operations.cpp;
${boost_path}/filesystem/src/path.cpp;
${boost_path}/filesystem/src/path_traits.cpp;
${boost_path}/filesystem/src/portability.cpp;
${boost_path}/filesystem/src/unique_path.cpp;
${boost_path}/filesystem/src/utf8_codecvt_facet.cpp;
${boost_path}/filesystem/src/windows_file_codecvt.cpp;
${boost_path}/filesystem/src/windows_file_codecvt.hpp;
)

Если это не работает, попробуйте

add_library(boost SHARED
${boost_path}/filesystem/src/codecvt_error_category.cpp
${boost_path}/filesystem/src/operations.cpp
${boost_path}/filesystem/src/path.cpp
${boost_path}/filesystem/src/path_traits.cpp
...
${boost_path}/filesystem/src/windows_file_codecvt.hpp)

Это может помочь отладить, где проблема.

2

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector