# # Copyright (c) 2014-2025 Enrico M. Crisostomo # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free Software # Foundation; either version 3, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program. If not, see . # cmake_minimum_required(VERSION 3.14) project(fswatch VERSION 1.19.0 LANGUAGES C CXX) set(VERSION_MODIFIER "-develop") set(FULL_VERSION "${PROJECT_VERSION}${VERSION_MODIFIER}") #@formatter:off set(PACKAGE "${PROJECT_NAME}") set(PACKAGE_NAME "${PACKAGE}") set(PACKAGE_VERSION "${FULL_VERSION}") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_AUTHOR "enrico.m.crisostomo@gmail.com") set(PACKAGE_BUGREPORT "${PACKAGE_AUTHOR}") set(PACKAGE_TARNAME "${PACKAGE}") set(PACKAGE_URL "https://github.com/emcrisostomo/${PACKAGE}") set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/locale" CACHE FILEPATH "locale dir") #@formatter:on if (NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 17) endif () set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) # Add option to choose between shared and static libraries option(BUILD_SHARED_LIBS "Build shared libraries" OFF) # Add option to build libfswatch only (without fswatch or tests) option(BUILD_LIBS_ONLY "Build libfswatch only" OFF) # include modules include(FindGettext) include(FindIntl) include(CheckIncludeFileCXX) include(CheckStructHasMember) include(CheckCXXSymbolExists) # check for gettext and libintl check_include_file_cxx(getopt.h HAVE_GETOPT_H) if (HAVE_GETOPT_H) check_cxx_symbol_exists(getopt_long getopt.h HAVE_GETOPT_LONG) endif (HAVE_GETOPT_H) # If both gettext and libintl are found, define the USE_NLS variable to # optionally disable them if (Intl_FOUND AND GETTEXT_FOUND) option(USE_NLS "Use NLS" ON) endif () if (USE_NLS) set(ENABLE_NLS 1) # gettext configuration set(LINGUAS en en@quot en@boldquot it es) foreach (language ${LINGUAS}) configure_file(${PROJECT_SOURCE_DIR}/po/${language}.po ${PROJECT_BINARY_DIR}/${language}.po COPYONLY) endforeach () gettext_process_pot_file(po/${PACKAGE}.pot ALL INSTALL_DESTINATION share/locale LANGUAGES ${LINGUAS}) endif () add_subdirectory(libfswatch) if (NOT BUILD_LIBS_ONLY) add_subdirectory(fswatch/src) add_subdirectory(test/src) endif ()