add more files msgs
This commit is contained in:
32
utils/CMakeLists.txt
Normal file
32
utils/CMakeLists.txt
Normal file
@@ -0,0 +1,32 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
# --- Project riêng cho utils ---
|
||||
project(utils LANGUAGES CXX)
|
||||
|
||||
# --- Tạo INTERFACE library (header-only) ---
|
||||
add_library(utils INTERFACE)
|
||||
|
||||
# --- Include directories ---
|
||||
target_include_directories(utils
|
||||
INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> # build nội bộ
|
||||
$<INSTALL_INTERFACE:include/utils> # dùng khi install/export
|
||||
)
|
||||
|
||||
# --- Cài đặt header files ---
|
||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
|
||||
DESTINATION include/utils
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
)
|
||||
|
||||
# --- Cài đặt target INTERFACE để export ---
|
||||
install(TARGETS utils
|
||||
EXPORT utils-targets
|
||||
)
|
||||
|
||||
# --- Export target file ---
|
||||
install(EXPORT utils-targets
|
||||
FILE utils-targets.cmake
|
||||
NAMESPACE utils::
|
||||
DESTINATION lib/cmake/utils
|
||||
)
|
||||
11
utils/utils.h
Normal file
11
utils/utils.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef UTILIS_MSGS_H
|
||||
#define UTILIS_MSGS_H
|
||||
#include <cmath>
|
||||
|
||||
template <typename T>
|
||||
bool isEqual(const T& a, const T& b, double eps = 1e-5)
|
||||
{
|
||||
return std::fabs(a - b) < eps;
|
||||
}
|
||||
|
||||
#endif // UTILIS_MSGS_H
|
||||
Reference in New Issue
Block a user