2024-05-29 23:11:52 +08:00
|
|
|
# Create static library
|
2024-06-03 14:24:05 +08:00
|
|
|
add_library(YYCCommonplace STATIC "")
|
|
|
|
# Setup static library sources
|
|
|
|
target_sources(YYCCommonplace
|
|
|
|
PRIVATE
|
2024-06-15 21:53:45 +08:00
|
|
|
# Sources
|
|
|
|
ConsoleHelper.cpp
|
|
|
|
DialogHelper.cpp
|
|
|
|
EncodingHelper.cpp
|
|
|
|
ExceptionHelper.cpp
|
|
|
|
FsPathPatch.cpp
|
|
|
|
IOHelper.cpp
|
|
|
|
ParserHelper.cpp
|
|
|
|
StringHelper.cpp
|
|
|
|
WinFctHelper.cpp
|
|
|
|
)
|
|
|
|
target_sources(YYCCommonplace
|
|
|
|
PUBLIC
|
|
|
|
FILE_SET HEADERS
|
|
|
|
FILES
|
2024-06-03 14:24:05 +08:00
|
|
|
# Headers
|
|
|
|
# Common headers
|
2024-06-15 21:53:45 +08:00
|
|
|
ConsoleHelper.hpp
|
|
|
|
DialogHelper.hpp
|
|
|
|
EncodingHelper.hpp
|
|
|
|
ExceptionHelper.hpp
|
|
|
|
FsPathPatch.hpp
|
|
|
|
IOHelper.hpp
|
|
|
|
ParserHelper.hpp
|
|
|
|
StringHelper.hpp
|
|
|
|
WinFctHelper.hpp
|
2024-06-03 14:24:05 +08:00
|
|
|
# Windows including guard pair
|
2024-06-15 21:53:45 +08:00
|
|
|
WinImportPrefix.hpp
|
|
|
|
WinImportSuffix.hpp
|
2024-06-03 14:24:05 +08:00
|
|
|
# Misc
|
2024-06-15 21:53:45 +08:00
|
|
|
YYCCInternal.hpp
|
|
|
|
YYCCommonplace.hpp
|
2024-05-29 23:11:52 +08:00
|
|
|
)
|
2024-06-15 21:53:45 +08:00
|
|
|
|
2024-05-29 23:11:52 +08:00
|
|
|
# Setup header infomations
|
|
|
|
target_include_directories(YYCCommonplace
|
|
|
|
PUBLIC
|
2024-06-03 14:24:05 +08:00
|
|
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>"
|
|
|
|
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
2024-05-29 23:11:52 +08:00
|
|
|
)
|
|
|
|
# Setup C++ standard
|
|
|
|
set_target_properties(YYCCommonplace
|
|
|
|
PROPERTIES
|
|
|
|
CXX_STANDARD 17
|
|
|
|
CXX_STANDARD_REQUIRED 17
|
|
|
|
CXX_EXTENSION OFF
|
|
|
|
)
|
2024-06-09 21:34:28 +08:00
|
|
|
# Order Unicode charset for private using
|
2024-05-29 23:11:52 +08:00
|
|
|
target_compile_definitions(YYCCommonplace
|
2024-06-09 21:34:28 +08:00
|
|
|
PRIVATE
|
|
|
|
$<$<CXX_COMPILER_ID:MSVC>:UNICODE>
|
|
|
|
$<$<CXX_COMPILER_ID:MSVC>:_UNICODE>
|
2024-05-29 23:11:52 +08:00
|
|
|
)
|
|
|
|
# Order build as UTF-8 in MSVC
|
|
|
|
target_compile_options(YYCCommonplace
|
|
|
|
PRIVATE
|
|
|
|
$<$<CXX_COMPILER_ID:MSVC>:/utf-8>
|
|
|
|
)
|
2024-06-03 14:24:05 +08:00
|
|
|
|
|
|
|
# Install project
|
|
|
|
# Install binary
|
|
|
|
install(TARGETS YYCCommonplace
|
|
|
|
EXPORT YYCCommonplaceTargets
|
|
|
|
LIBRARY DESTINATION lib
|
|
|
|
ARCHIVE DESTINATION lib
|
|
|
|
RUNTIME DESTINATION bin
|
|
|
|
INCLUDES DESTINATION include
|
2024-06-15 21:53:45 +08:00
|
|
|
FILE_SET HEADERS DESTINATION include
|
2024-06-03 14:24:05 +08:00
|
|
|
)
|