Библиотека требует сборки в объектный файл (из-за moc)
This commit is contained in:
52
examples/filesystem/01_paths/CMakeLists.txt
Normal file
52
examples/filesystem/01_paths/CMakeLists.txt
Normal file
@ -0,0 +1,52 @@
|
||||
# Название основной цели в текущем каталоге
|
||||
set(TRGT example-filesystem-paths)
|
||||
|
||||
# Список файлов исходных текстов
|
||||
set(TRGT_cpp ${CMAKE_CURRENT_SOURCE_DIR}/paths.cpp)
|
||||
|
||||
if(MYXLIB_BUILD_EXAMPLES)
|
||||
# Путь поиска библиотек внутри проекта
|
||||
link_directories(${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
# Цель для создания исполняемого файла
|
||||
add_executable(${TRGT} ${TRGT_cpp} ${TRGT_qrc})
|
||||
common_target_properties(${TRGT})
|
||||
|
||||
# Создание цели для проверки утилитой clang-tidy
|
||||
add_clang_tidy_check(${TRGT} ${TRGT_cpp})
|
||||
|
||||
# Создание цели для проверки утилитой clang-analyze
|
||||
add_clang_analyze_check(${TRGT} ${TRGT_cpp})
|
||||
|
||||
# Создание цели для проверки утилитой clazy
|
||||
add_clazy_check(${TRGT} ${TRGT_cpp})
|
||||
|
||||
# Создание цели для проверки утилитой pvs-studio
|
||||
add_pvs_check(${TRGT})
|
||||
|
||||
# Создание цели для автоматического форматирования кода
|
||||
add_format_sources(${TRGT} ${TRGT_cpp})
|
||||
|
||||
# Qt5
|
||||
target_include_directories(${TRGT} PRIVATE ${CMAKE_SOURCE_DIR}/src)
|
||||
target_include_directories(${TRGT} SYSTEM PUBLIC ${Qt5Core_INCLUDE_DIRS})
|
||||
|
||||
target_include_directories(${TRGT} SYSTEM PRIVATE ${CMAKE_SOURCE_DIR}/src)
|
||||
add_dependencies(${TRGT} base filesystem)
|
||||
|
||||
target_link_libraries(${TRGT} base_static filesystem_static)
|
||||
target_link_libraries(${TRGT} Qt5::Core)
|
||||
target_link_libraries(${TRGT} Threads::Threads)
|
||||
|
||||
# Имя выходного файла для цели
|
||||
set_target_properties(${TRGT} PROPERTIES OUTPUT_NAME filesystem-minimal)
|
||||
|
||||
add_sanitizers(${TRGT})
|
||||
|
||||
cotire(${TRGT})
|
||||
|
||||
add_dependencies(${TRGT} create_auxilary_symlinks)
|
||||
|
||||
# Правила для установки
|
||||
install(TARGETS ${TRGT} COMPONENT examples RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
endif()
|
42
examples/filesystem/01_paths/paths.cpp
Normal file
42
examples/filesystem/01_paths/paths.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
#include <myx/base/config.hpp>
|
||||
|
||||
#include <myx/filesystem/paths.hpp>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
|
||||
#define CMLIB_PROJECT_NAME "myxlib"
|
||||
|
||||
namespace MF = myx::filesystem;
|
||||
|
||||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
QCoreApplication::setApplicationName( QStringLiteral( CMLIB_PROJECT_NAME ) );
|
||||
MF::Paths& paths = MF::Paths::instance();
|
||||
|
||||
paths.init( QStringLiteral( CMLIB_PROJECT_NAME ), QStringLiteral( "conf" ) );
|
||||
|
||||
qDebug() << "prefixDirectory : " << paths.prefixDirectory();
|
||||
|
||||
qDebug() << "executableName : " << paths.executableName();
|
||||
qDebug() << "executableFilePath : " << paths.executableFilePath();
|
||||
qDebug() << "executableDirectory : " << paths.executableDirectory();
|
||||
|
||||
qDebug() << "configFileName : " << paths.configFileName();
|
||||
qDebug() << "configFilePath : " << paths.configFilePath();
|
||||
|
||||
qDebug() << "systemConfigDirectory : " << paths.systemConfigDirectory();
|
||||
qDebug() << "systemConstDataDirectory : " << paths.systemConstDataDirectory();
|
||||
qDebug() << "systemVarDataDirectory : " << paths.systemVarDataDirectory();
|
||||
qDebug() << "systemLogDirectory : " << paths.systemLogDirectory();
|
||||
|
||||
qDebug() << "userConfigDirectory : " << paths.userConfigDirectory();
|
||||
qDebug() << "userConstDataDirectory : " << paths.userConstDataDirectory();
|
||||
qDebug() << "userVarDataDirectory : " << paths.userVarDataDirectory();
|
||||
qDebug() << "userLogDirectory : " << paths.userLogDirectory();
|
||||
|
||||
return( 0 );
|
||||
} // main
|
Reference in New Issue
Block a user