| 1 |
# |
| 2 |
# The relative source and module paths seem to work inconsistently on Windows |
| 3 |
# and Nix (flakes). This file used to live around the build/in and |
| 4 |
# build/in/cmake directories. For now, it seems easiest to leave it here, as |
| 5 |
# one megafile, in the project's root directory. |
| 6 |
# |
| 7 |
|
| 8 |
cmake_policy(SET CMP0048 NEW) # For VERSION in project() |
| 9 |
cmake_policy(SET CMP0069 NEW) # For better IPO support |
| 10 |
cmake_minimum_required(VERSION 3.9) |
| 11 |
|
| 12 |
project( |
| 13 |
wtr.watcher |
| 14 |
VERSION 0.13.6 # hook: tool/release |
| 15 |
DESCRIPTION "watcher: a filesystem watcher" |
| 16 |
HOMEPAGE_URL "github.com/e-dant/watcher" |
| 17 |
LANGUAGES |
| 18 |
CXX |
| 19 |
C |
| 20 |
) |
| 21 |
|
| 22 |
# |
| 23 |
# Options, Variable & Constants |
| 24 |
# |
| 25 |
|
| 26 |
option(BUILD_LIB "Create targets for the watcher-c libraries" ON) |
| 27 |
option(BUILD_BIN "Create targets for the CLI binaries" ON) |
| 28 |
option(BUILD_HDR "Create targets for the headers (both the C++ single-header library and the watcher-c library header)" ON) |
| 29 |
option(BUILD_TESTING "Create targets for the test programs" OFF) |
| 30 |
option(BUILD_SAN "Mega-option to allow sanitizers" OFF) |
| 31 |
option(BUILD_ASAN "Create targets address-sanitized libraries and binaries" OFF) |
| 32 |
option(BUILD_MSAN "Create targets memory-sanitized libraries and binaries" OFF) |
| 33 |
option(BUILD_TSAN "Create targets thread-sanitized libraries and binaries" OFF) |
| 34 |
option(BUILD_UBSAN "Create targets undefined-behavior-sanitized libraries and binaries" OFF) |
| 35 |
|
| 36 |
set(WTR_WATCHER_CXX_STD 17) |
| 37 |
|
| 38 |
set(CMAKE_EXPORT_COMPILE_COMMANDS 1) |
| 39 |
|
| 40 |
set(IS_CC_CLANG 0) |
| 41 |
set(IS_CC_ANYCLANG 0) |
| 42 |
set(IS_CC_APPLECLANG 0) |
| 43 |
set(IS_CC_GCC 0) |
| 44 |
set(IS_CC_MSVC 0) |
| 45 |
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") |
| 46 |
set(IS_CC_MSVC 1) |
| 47 |
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") |
| 48 |
set(IS_CC_GCC 1) |
| 49 |
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") |
| 50 |
set(IS_CC_ANYCLANG 1) |
| 51 |
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") |
| 52 |
set(IS_CC_APPLECLANG 1) |
| 53 |
else() |
| 54 |
set(IS_CC_CLANG 1) |
| 55 |
endif() |
| 56 |
endif() |
| 57 |
|
| 58 |
if(NOT CMAKE_BUILD_TYPE) |
| 59 |
set(CMAKE_BUILD_TYPE "Release") |
| 60 |
endif() |
| 61 |
|
| 62 |
if(NOT IS_CC_MSVC) |
| 63 |
# It's not that we don't want these, it's just that I hate Windows. |
| 64 |
# Also, MSVC doesn't support some of these arguments, so it's not possible. |
| 65 |
set(COMPILE_OPTIONS |
| 66 |
"${COMPILE_OPTIONS}" |
| 67 |
"-Wall" |
| 68 |
"-Wextra" |
| 69 |
"-Werror" |
| 70 |
"-Wno-unused-function" |
| 71 |
"-Wno-unneeded-internal-declaration" |
| 72 |
) |
| 73 |
endif() |
| 74 |
|
| 75 |
if(NOT WIN32 AND NOT IS_CC_MSVC) |
| 76 |
# TODO: strict-aliasing |
| 77 |
set(COMPILE_OPTIONS |
| 78 |
"${COMPILE_OPTIONS}" |
| 79 |
"-Wno-ignored-optimization-argument" # For Android's clang |
| 80 |
"-Wno-unused-command-line-argument" # For clang-11 |
| 81 |
"-fno-exceptions" |
| 82 |
"-fno-rtti" |
| 83 |
"-fstrict-enums" |
| 84 |
"-fstrict-overflow" |
| 85 |
) |
| 86 |
if(IS_CC_CLANG) |
| 87 |
set(COMPILE_OPTIONS |
| 88 |
"${COMPILE_OPTIONS}" |
| 89 |
"-fstrict-return" |
| 90 |
"-fstrict-float-cast-overflow" |
| 91 |
) |
| 92 |
endif() |
| 93 |
if(NOT IS_CC_APPLECLANG) |
| 94 |
set(COMPILE_OPTIONS |
| 95 |
"${COMPILE_OPTIONS}" |
| 96 |
"-fexpensive-optimizations" |
| 97 |
) |
| 98 |
endif() |
| 99 |
endif() |
| 100 |
|
| 101 |
if(ANDROID) |
| 102 |
# Android's stdlib ("bionic") doesn't need to be linked with (p)threads. |
| 103 |
set(LINK_LIBRARIES "${LINK_LIBRARIES}") |
| 104 |
else() |
| 105 |
find_package(Threads REQUIRED) |
| 106 |
set(LINK_LIBRARIES |
| 107 |
"${LINK_LIBRARIES}" |
| 108 |
"Threads::Threads" |
| 109 |
) |
| 110 |
if(APPLE) |
| 111 |
list(APPEND LINK_LIBRARIES |
| 112 |
"-framework CoreFoundation" |
| 113 |
"-framework CoreServices" |
| 114 |
) |
| 115 |
endif() |
| 116 |
endif() |
| 117 |
|
| 118 |
set(INCLUDE_PATH_DEVEL "devel/include") |
| 119 |
|
| 120 |
set(ALLOWED_asan 0) |
| 121 |
set(ALLOWED_msan 0) |
| 122 |
set(ALLOWED_tsan 0) |
| 123 |
set(ALLOWED_ubsan 0) |
| 124 |
set(ALLOWED_stacksan 0) |
| 125 |
set(ALLOWED_dataflowsan 0) |
| 126 |
set(ALLOWED_cfisan 0) |
| 127 |
set(ALLOWED_kcfisan 0) |
| 128 |
if(NOT WIN32 AND (BUILD_ASAN OR BUILD_SAN)) |
| 129 |
set(ALLOWED_asan 1) |
| 130 |
endif() |
| 131 |
if(IS_CC_CLANG AND NOT ANDROID AND (BUILD_MSAN OR BUILD_SAN)) |
| 132 |
set(ALLOWED_msan 1) |
| 133 |
endif() |
| 134 |
if(NOT ANDROID AND NOT WIN32 AND (BUILD_TSAN OR BUILD_SAN)) |
| 135 |
set(ALLOWED_tsan 1) |
| 136 |
endif() |
| 137 |
if(NOT WIN32 AND (BUILD_UBSAN OR BUILD_SAN)) |
| 138 |
set(ALLOWED_ubsan 1) |
| 139 |
endif() |
| 140 |
set(SAN_NAMES "asan" "msan" "tsan" "ubsan") |
| 141 |
set(CCLL_EXTOPT_SET_ASAN "-fno-omit-frame-pointer" "-fsanitize=address") |
| 142 |
set(CCLL_EXTOPT_SET_MSAN "-fno-omit-frame-pointer" "-fsanitize=memory") |
| 143 |
set(CCLL_EXTOPT_SET_TSAN "-fno-omit-frame-pointer" "-fsanitize=thread") |
| 144 |
set(CCLL_EXTOPT_SET_UBSAN "-fno-omit-frame-pointer" "-fsanitize=undefined") |
| 145 |
set(CCLL_EXTOPT_SET_STACKSAN "-fno-omit-frame-pointer" "-fsanitize=safe-stack") |
| 146 |
set(CCLL_EXTOPT_SET_DATAFLOWSAN "-fno-omit-frame-pointer" "-fsanitize=dataflow") |
| 147 |
set(CCLL_EXTOPT_SET_CFISAN "-fno-omit-frame-pointer" "-fsanitize=cfi") |
| 148 |
set(CCLL_EXTOPT_SET_KCFISAN "-fno-omit-frame-pointer" "-fsanitize=kcfi") |
| 149 |
|
| 150 |
set(SAN_SUPPORTED) |
| 151 |
foreach(SAN ${SAN_NAMES}) |
| 152 |
if(ALLOWED_${SAN}) |
| 153 |
list(APPEND SAN_SUPPORTED ${SAN}) |
| 154 |
endif() |
| 155 |
endforeach() |
| 156 |
|
| 157 |
message(STATUS "Supported sanitizers on ${CMAKE_SYSTEM}/${CMAKE_CXX_COMPILER_ID}: ${SAN_SUPPORTED}") |
| 158 |
|
| 159 |
# |
| 160 |
# Functions |
| 161 |
# |
| 162 |
|
| 163 |
function(wtr_add_bin_target |
| 164 |
NAME |
| 165 |
BIN_COMPONENT_NAME |
| 166 |
IS_TEST |
| 167 |
SRC_SET |
| 168 |
CC_OPT_SET |
| 169 |
LL_OPT_SET |
| 170 |
INCLUDE_PATH |
| 171 |
LLIB_SET) |
| 172 |
if(NOT IS_TEST AND NOT BUILD_BIN) |
| 173 |
message(STATUS "${NAME}: Skipped (BUILD_BIN=${BUILD_BIN})") |
| 174 |
return() |
| 175 |
elseif(NOT IS_TEST) |
| 176 |
message(STATUS "${NAME}: Added (BUILD_BIN=${BUILD_BIN})") |
| 177 |
endif() |
| 178 |
if(IS_TEST AND NOT BUILD_TESTING) |
| 179 |
message(STATUS "${NAME}: Skipped (BUILD_TESTING=${BUILD_TESTING})") |
| 180 |
return() |
| 181 |
elseif(IS_TEST) |
| 182 |
message(STATUS "${NAME}: Added (BUILD_TESTING=${BUILD_TESTING})") |
| 183 |
endif() |
| 184 |
include(CheckIPOSupported) |
| 185 |
include(FetchContent) |
| 186 |
include(GNUInstallDirs) |
| 187 |
add_executable("${NAME}" "${SRC_SET}") |
| 188 |
set_property(TARGET "${NAME}" PROPERTY CXX_STANDARD "${WTR_WATCHER_CXX_STD}") |
| 189 |
if(NOT WIN32 AND NOT IS_CC_MSVC AND NOT IS_CC_APPLECLANG) |
| 190 |
target_compile_options("${NAME}" PRIVATE "${CC_OPT_SET};-fwhole-program") |
| 191 |
else() |
| 192 |
target_compile_options("${NAME}" PRIVATE "${CC_OPT_SET}") |
| 193 |
endif() |
| 194 |
target_link_options("${NAME}" PRIVATE "${LL_OPT_SET}") |
| 195 |
target_include_directories("${NAME}" PUBLIC "${INCLUDE_PATH}") |
| 196 |
target_link_libraries("${NAME}" PRIVATE "${LLIB_SET}") |
| 197 |
check_ipo_supported(RESULT ipo_supported) |
| 198 |
if(ipo_supported) |
| 199 |
set_property(TARGET "${NAME}" PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) |
| 200 |
endif() |
| 201 |
if(APPLE) |
| 202 |
set_property( |
| 203 |
TARGET "${NAME}" |
| 204 |
PROPERTY XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "org.${NAME}" |
| 205 |
) |
| 206 |
endif() |
| 207 |
if(IS_TEST) |
| 208 |
if(DEFINED ENV{WTR_WATCHER_USE_SYSTEM_SNITCH}) |
| 209 |
find_package(snitch REQUIRED) |
| 210 |
else() |
| 211 |
FetchContent_Declare( |
| 212 |
snitch |
| 213 |
GIT_REPOSITORY https://github.com/cschreib/snitch.git |
| 214 |
# v1.1.1 Doesn't show time as nice as v1.0.0 |
| 215 |
# Tuesday, June 29th, 2023 @ v1.1.1 |
| 216 |
GIT_TAG 5ad2fffebf31f3e6d56c2c0ab27bc45d01da2f05 |
| 217 |
# Friday, January 20th, 2023 @ v1.0.0 |
| 218 |
# GIT_TAG ea200a0830394f8e0ef732064f0935a77c003bd6 |
| 219 |
# Saturday, January 7th, 2023 @ main |
| 220 |
# GIT_TAG 8165d6c85353f9c302ce05f1c1c47dcfdc6aeb2c |
| 221 |
# Tuesday, December 18th, 2022 @ v0.1.3 |
| 222 |
# GIT_TAG f313bccafe98aaef617af3bf457d091d8d50cdcd |
| 223 |
# Friday, December 2nd, 2022 @ main |
| 224 |
# GIT_TAG c0b6ac4efe4019e4846e8967fe21de864b0cc1ed |
| 225 |
) |
| 226 |
FetchContent_MakeAvailable(snitch) |
| 227 |
endif() |
| 228 |
endif() |
| 229 |
if(BIN_COMPONENT_NAME) |
| 230 |
install( |
| 231 |
TARGETS "${NAME}" |
| 232 |
DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" |
| 233 |
COMPONENT "${BIN_COMPONENT_NAME}" |
| 234 |
) |
| 235 |
endif() |
| 236 |
endfunction() |
| 237 |
|
| 238 |
function(wtr_add_lib_target NAME OUTPUT_NAME SRC_SET INC_SET LIB_TYPE) |
| 239 |
if(NOT BUILD_LIB) |
| 240 |
message(STATUS "${NAME}: Skipped (BUILD_LIB=${BUILD_LIB})") |
| 241 |
return() |
| 242 |
endif() |
| 243 |
message(STATUS "${NAME}: Added (BUILD_LIB=${BUILD_LIB})") |
| 244 |
include(GNUInstallDirs) |
| 245 |
add_library("${NAME}" "${LIB_TYPE}" "${SRC_SET}") |
| 246 |
target_include_directories("${NAME}" PRIVATE "${INC_SET}") |
| 247 |
set_property(TARGET "${NAME}" PROPERTY CXX_STANDARD "${WTR_WATCHER_CXX_STD}") |
| 248 |
set_property(TARGET "${NAME}" PROPERTY VERSION "${PROJECT_VERSION}") |
| 249 |
set_property(TARGET "${NAME}" PROPERTY SOVERSION "${PROJECT_VERSION_MAJOR}") |
| 250 |
set_property(TARGET "${NAME}" PROPERTY POSITION_INDEPENDENT_CODE ON) |
| 251 |
set_property(TARGET "${NAME}" PROPERTY OUTPUT_NAME "${OUTPUT_NAME}") |
| 252 |
target_compile_options("${NAME}" PRIVATE "${COMPILE_OPTIONS}") |
| 253 |
if("${NAME}" STREQUAL "watcher-c-shared" AND LINUX) |
| 254 |
message(STATUS "watcher-c-shared: Adding version script") |
| 255 |
target_link_options("${NAME}" PRIVATE "${LINK_OPTIONS};-Wl,--version-script=${CMAKE_SOURCE_DIR}/watcher-c/libwatcher-c.version") |
| 256 |
else() |
| 257 |
target_link_options("${NAME}" PRIVATE "${LINK_OPTIONS}") |
| 258 |
endif() |
| 259 |
target_link_libraries("${NAME}" PRIVATE "${LINK_LIBRARIES}") |
| 260 |
if(APPLE) |
| 261 |
set_property(TARGET "${NAME}" PROPERTY INSTALL_RPATH "/usr/local/lib") |
| 262 |
set_property(TARGET "${NAME}" PROPERTY BUILD_RPATH "/usr/local/lib") |
| 263 |
endif() |
| 264 |
install( |
| 265 |
TARGETS "${NAME}" |
| 266 |
DESTINATION "${CMAKE_INSTALL_LIBDIR}" |
| 267 |
COMPONENT "lib" |
| 268 |
) |
| 269 |
endfunction() |
| 270 |
|
| 271 |
function(wtr_add_hdr_target NAME HDR_SET) |
| 272 |
if(NOT BUILD_HDR) |
| 273 |
message(STATUS "${NAME}: Skipped (BUILD_HDR=${BUILD_HDR})") |
| 274 |
return() |
| 275 |
endif() |
| 276 |
message(STATUS "${NAME}: Added (BUILD_HDR=${BUILD_HDR})") |
| 277 |
include(GNUInstallDirs) |
| 278 |
add_library("${NAME}" INTERFACE "${HDR_SET}") |
| 279 |
target_include_directories("${NAME}" INTERFACE "${INCLPATH}") |
| 280 |
install(FILES "${HDR_SET}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/wtr" COMPONENT "include") |
| 281 |
endfunction() |
| 282 |
|
| 283 |
function(wtr_add_rel_bin_target NAME SRC_SET) |
| 284 |
wtr_add_bin_target( |
| 285 |
"${NAME}" |
| 286 |
"bin" |
| 287 |
"OFF" # is test |
| 288 |
"${SRC_SET}" |
| 289 |
"${COMPILE_OPTIONS}" |
| 290 |
"${LINK_OPTIONS}" |
| 291 |
"include" |
| 292 |
"${LINK_LIBRARIES}" |
| 293 |
) |
| 294 |
endfunction() |
| 295 |
|
| 296 |
function(wtr_add_test_bin_target NAME SRC_SET) |
| 297 |
wtr_add_bin_target( |
| 298 |
"${NAME}" |
| 299 |
"test-bin" |
| 300 |
"ON" # is test |
| 301 |
"${SRC_SET}" |
| 302 |
"${COMPILE_OPTIONS}" |
| 303 |
"${LINK_OPTIONS}" |
| 304 |
"${INCLUDE_PATH_DEVEL}" |
| 305 |
"${LINK_LIBRARIES};snitch::snitch" |
| 306 |
) |
| 307 |
endfunction() |
| 308 |
|
| 309 |
function(wtr_add_san_rel_bin_target NAME SRC_SET SAN) |
| 310 |
wtr_add_bin_target( |
| 311 |
"${NAME}.${SAN}" |
| 312 |
"test-bin" |
| 313 |
"OFF" # is test |
| 314 |
"${SRC_SET}" |
| 315 |
"${COMPILE_OPTIONS};${CCLL_EXTOPT_SET_${SAN}}" |
| 316 |
"${LINK_OPTIONS};${CCLL_EXTOPT_SET_${SAN}}" |
| 317 |
"${INCLUDE_PATH_DEVEL}" |
| 318 |
"${LINK_LIBRARIES}" |
| 319 |
) |
| 320 |
endfunction() |
| 321 |
|
| 322 |
function(wtr_add_san_test_bin_target NAME SRC_SET SAN) |
| 323 |
wtr_add_bin_target( |
| 324 |
"${NAME}.${SAN}" |
| 325 |
"test-bin" |
| 326 |
"ON" # is test |
| 327 |
"${SRC_SET}" |
| 328 |
"${COMPILE_OPTIONS};${CCLL_EXTOPT_SET_${SAN}}" |
| 329 |
"${LINK_OPTIONS};${CCLL_EXTOPT_SET_${SAN}}" |
| 330 |
"${INCLUDE_PATH_DEVEL}" |
| 331 |
"${LINK_LIBRARIES};snitch::snitch" |
| 332 |
) |
| 333 |
endfunction() |
| 334 |
|
| 335 |
function(wtr_add_autosan_bin_target NAME SRC_SET IS_TEST) |
| 336 |
if(IS_TEST) |
| 337 |
wtr_add_test_bin_target("${NAME}" "${SRC_SET}") |
| 338 |
else() |
| 339 |
wtr_add_rel_bin_target("${NAME}" "${SRC_SET}") |
| 340 |
endif() |
| 341 |
foreach(SAN ${SAN_NAMES}) |
| 342 |
string(TOUPPER ${SAN} UPPER_SAN) |
| 343 |
if(NOT BUILD_SAN AND NOT BUILD_${UPPER_SAN}) |
| 344 |
message(STATUS "${NAME}.${SAN}: Skipped (BUILD_SAN=${BUILD_SAN}, BUILD_${UPPER_SAN}=${BUILD_${UPPER_SAN}})") |
| 345 |
elseif(NOT ALLOWED_${SAN}) |
| 346 |
message(STATUS "${NAME}.${SAN}: Skipped (Unsupported on ${CMAKE_SYSTEM}/${CMAKE_CXX_COMPILER_ID})") |
| 347 |
elseif(IS_TEST) |
| 348 |
wtr_add_san_test_bin_target("${NAME}" "${SRC_SET}" "${SAN}") |
| 349 |
else() |
| 350 |
wtr_add_san_rel_bin_target("${NAME}" "${SRC_SET}" "${SAN}") |
| 351 |
endif() |
| 352 |
endforeach() |
| 353 |
endfunction() |
| 354 |
|
| 355 |
function(wtr_add_san_lib_target NAME OUTPUT_NAME SRC_SET INC_SET LIB_TYPE SAN) |
| 356 |
string(TOUPPER "${SAN}" UPPER_SAN) |
| 357 |
if (NOT BUILD_LIB) |
| 358 |
message(STATUS "${NAME}: Skipped (BUILD_LIB=${BUILD_LIB})") |
| 359 |
return() |
| 360 |
elseif (NOT BUILD_SAN AND NOT BUILD_${UPPER_SAN}) |
| 361 |
message(STATUS "${NAME}: Skipped (BUILD_SAN=${BUILD_SAN}, BUILD_${UPPER_SAN}=${BUILD_${UPPER_SAN}})") |
| 362 |
return() |
| 363 |
elseif (NOT ALLOWED_${SAN}) |
| 364 |
message(STATUS "${NAME}: Skipped (Unsupported on ${CMAKE_SYSTEM}/${CMAKE_CXX_COMPILER_ID})") |
| 365 |
return() |
| 366 |
endif() |
| 367 |
message(STATUS "${NAME}: Added (BUILD_SAN=${BUILD_SAN}, BUILD_${UPPER_SAN}=${BUILD_${UPPER_SAN}}, BUILD_LIB=${BUILD_LIB})") |
| 368 |
wtr_add_lib_target("${NAME}" "${OUTPUT_NAME}" "${SRC_SET}" "${INC_SET}" "${LIB_TYPE}") |
| 369 |
target_compile_options("${NAME}" PRIVATE "${COMPILE_OPTIONS};${CCLL_EXTOPT_SET_${UPPER_SAN}}") |
| 370 |
target_link_options("${NAME}" PRIVATE "${LINK_OPTIONS};${CCLL_EXTOPT_SET_${UPPER_SAN}}") |
| 371 |
endfunction() |
| 372 |
|
| 373 |
function(wtr_add_autosan_lib_target NAME OUTPUT_NAME SRC_SET INC_SET LIB_TYPE) |
| 374 |
wtr_add_lib_target("${NAME}" "${OUTPUT_NAME}" "${SRC_SET}" "${INC_SET}" "${LIB_TYPE}") |
| 375 |
foreach(SAN ${SAN_NAMES}) |
| 376 |
string(TOUPPER ${SAN} UPPER_SAN) |
| 377 |
wtr_add_san_lib_target("${NAME}.${SAN}" "${OUTPUT_NAME}.${SAN}" "${SRC_SET}" "${INC_SET}" "${LIB_TYPE}" "${SAN}") |
| 378 |
endforeach() |
| 379 |
endfunction() |
| 380 |
|
| 381 |
# |
| 382 |
# Actual work |
| 383 |
# |
| 384 |
|
| 385 |
wtr_add_hdr_target( |
| 386 |
"wtr.hdr_watcher" |
| 387 |
"include/wtr/watcher.hpp" |
| 388 |
) |
| 389 |
|
| 390 |
wtr_add_hdr_target( |
| 391 |
"watcher-c-hdr" |
| 392 |
"watcher-c/include/wtr/watcher-c.h" |
| 393 |
) |
| 394 |
|
| 395 |
wtr_add_autosan_lib_target( |
| 396 |
"watcher-c-shared" |
| 397 |
"watcher-c" |
| 398 |
"watcher-c/src/watcher-c.cpp" |
| 399 |
"watcher-c/include;${CMAKE_SOURCE_DIR}/include" |
| 400 |
"SHARED" |
| 401 |
) |
| 402 |
|
| 403 |
wtr_add_autosan_lib_target( |
| 404 |
"watcher-c-static" |
| 405 |
"watcher-c" |
| 406 |
"watcher-c/src/watcher-c.cpp" |
| 407 |
"watcher-c/include;${CMAKE_SOURCE_DIR}/include" |
| 408 |
"STATIC" |
| 409 |
) |
| 410 |
|
| 411 |
wtr_add_autosan_bin_target( |
| 412 |
"wtr.watcher" |
| 413 |
"src/wtr/watcher/main.cpp" |
| 414 |
OFF |
| 415 |
) |
| 416 |
|
| 417 |
wtr_add_autosan_bin_target( |
| 418 |
"tw" |
| 419 |
"src/wtr/tiny_watcher/main.cpp" |
| 420 |
OFF |
| 421 |
) |
| 422 |
|
| 423 |
set(WTR_TEST_WATCHER_SOURCE_SET |
| 424 |
"devel/src/wtr/test_watcher/test_concurrency.cpp" |
| 425 |
"devel/src/wtr/test_watcher/test_event_targets.cpp" |
| 426 |
"devel/src/wtr/test_watcher/test_new_directories.cpp" |
| 427 |
"devel/src/wtr/test_watcher/test_simple.cpp" |
| 428 |
"devel/src/wtr/test_watcher/test_performance.cpp" |
| 429 |
"devel/src/wtr/test_watcher/test_openclose.cpp" |
| 430 |
) |
| 431 |
wtr_add_autosan_bin_target( |
| 432 |
"wtr.test_watcher" |
| 433 |
"${WTR_TEST_WATCHER_SOURCE_SET}" |
| 434 |
ON |
| 435 |
) |
| 436 |
|
| 437 |
# Used in the tool/test suite. Platforms vary |
| 438 |
# in their mv(1) implementations. We smooth |
| 439 |
# over that by using the `rename` system call, |
| 440 |
# which doesn't vary much at all. |
| 441 |
wtr_add_bin_target( |
| 442 |
"portable-destructive-rename" |
| 443 |
"test-bin" |
| 444 |
ON |
| 445 |
"devel/src/portable-destructive-rename/main.c" |
| 446 |
"" |
| 447 |
"" |
| 448 |
"" |
| 449 |
"" |
| 450 |
) |
| 451 |
|