Базовая библиотека

This commit is contained in:
2019-02-12 22:00:28 +03:00
parent 604a600690
commit 451708a3ba
5 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,28 @@
# Название основной цели и имя библиотеки в текущем каталоге
set(current_target cmex)
# Список файлов исходных текстов
set(current_target_sources
cmex.cpp
)
# Список заголовочных файлов (используется для установки)
set(current_target_headers
cmex.hpp
)
add_common_library(${current_target} ${current_target_sources})
common_target_properties(${current_target})
# Цель, используемая только для установки заголовочных файлов, без компиляции проекта
add_custom_target(${current_target}-install-headers
COMMAND "${CMAKE_COMMAND}"
-DCMAKE_INSTALL_COMPONENT=headers -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
)
# Правила для установки
install(TARGETS ${current_target}_static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS ${current_target}_shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES ${CMAKE_BINARY_DIR}/include/config.hpp ${current_target_headers}
COMPONENT headers DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${current_target})

6
src/libcmex/cmex.cpp Normal file
View File

@ -0,0 +1,6 @@
#include "cmex.hpp"
int32_t cmex_init(int32_t i = 0) {
return i;
}

9
src/libcmex/cmex.hpp Normal file
View File

@ -0,0 +1,9 @@
#ifndef LIBCMEX_CMEX_HPP_
#define LIBCMEX_CMEX_HPP_
#include <stdint.h>
int32_t cmex_init(int32_t i);
#endif // LIBCMEX_CMEX_HPP_