cmake_minimum_required(VERSION 3.13 FATAL_ERROR) project(netty-channel-unix-native VERSION 4.1.104 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) include(GNUInstallDirs) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}) # jvm find_package(Java REQUIRED) # https://stackoverflow.com/questions/51047978/cmake-could-not-find-jni set(JAVA_AWT_LIBRARY NotNeeded) set(JAVA_JVM_LIBRARY NotNeeded) find_package(JNI REQUIRED) include_directories(${JNI_INCLUDE_DIRS}) # force off-tree build if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) message(FATAL_ERROR "CMake generation is not allowed within the source directory! Remove the CMakeCache.txt file and try again from another folder, e.g.: mkdir build && cd build cmake .. ") endif() # default to Release build if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE) endif() include_directories(src/main/include) add_subdirectory(src/main/c)