### Build open.mp on Mac Source: https://github.com/openmultiplayer/open.mp/blob/master/README.md Build the open.mp project on macOS using CMake. Ensure conan@1 is installed and aliased. ```bash brew install conan@1 sudo ln -s /usr/local/opt/conan@1/bin/conan /usr/local/bin/conan cd open.mp mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release .. make ``` -------------------------------- ### Add Server Component Function Source: https://github.com/openmultiplayer/open.mp/blob/master/Server/CMakeLists.txt Defines a CMake function to add a server component. This function handles project setup, source file globbing, library creation, linking, and compile definitions. ```cmake function(add_server_component name) project(${name}) file(GLOB_RECURSE component_source_list "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") add_library(${PROJECT_NAME} SHARED ${component_source_list}) target_link_libraries(${PROJECT_NAME} PRIVATE OMP-SDK OMP-NetCode ) target_compile_definitions(${PROJECT_NAME} PRIVATE OMP_VERSION_MAJOR=${CMAKE_PROJECT_VERSION_MAJOR} OMP_VERSION_MINOR=${CMAKE_PROJECT_VERSION_MINOR} OMP_VERSION_PATCH=${CMAKE_PROJECT_VERSION_PATCH} ) if(NOT MSVC) target_compile_options(${PROJECT_NAME} PRIVATE -fno-eliminate-unused-debug-types) endif() if(DEFINED ENV{OMP_BUILD_VERSION}) target_compile_definitions(${PROJECT_NAME} PRIVATE BUILD_NUMBER=$ENV{OMP_BUILD_VERSION}) endif() GroupSourcesByFolder(${PROJECT_NAME}) set_property(TARGET ${PROJECT_NAME} PROPERTY OUTPUT_NAME ${PROJECT_NAME}) set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER "Server/Components") if(MSVC) set_property(TARGET ${PROJECT_NAME} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/components) else() set_property(TARGET ${PROJECT_NAME} PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/components) endif() set_property(TARGET ${PROJECT_NAME} PROPERTY PREFIX "") endfunction() ``` -------------------------------- ### Configure Legacy Network Component Source: https://github.com/openmultiplayer/open.mp/blob/master/Server/Components/LegacyNetwork/CMakeLists.txt Sets up the project ID, adds the server component, defines preprocessor macros, and links necessary libraries for the legacy network component. ```cmake get_filename_component(ProjectId ${CMAKE_CURRENT_SOURCE_DIR} NAME) add_server_component(${ProjectId}) ``` ```cmake add_definitions( -DTTMATH_NOASM ) ``` ```cmake target_link_libraries(${ProjectId} PRIVATE raknet ttmath ) ``` -------------------------------- ### Build open.mp on Windows Source: https://github.com/openmultiplayer/open.mp/blob/master/README.md Build the open.mp project on Windows using CMake with ClangCL. ```bash cd open.mp mkdir build cd build cmake .. -A Win32 -T ClangCL cmake --build . --config RelWithDebInfo ``` -------------------------------- ### Run Docker Container with ReleaseWithDebInfo Build Source: https://github.com/openmultiplayer/open.mp/blob/master/docker/build_ubuntu-22.04/README.md Run the Docker container to build open.mp with the RelWithDebInfo configuration. This provides a balance between optimization and debug information for release builds. ```bash docker run --rm -ti -e CONFIG=RelWithDebInfo -v /path/to/omp/sources:/omp -w /omp open.mp/build:ubuntu-22.04 ``` -------------------------------- ### Run Docker Container to Build open.mp Source: https://github.com/openmultiplayer/open.mp/blob/master/docker/abicheck_ubuntu-18.04/README.md Run a Docker container to compile open.mp. Mount your source code into the container and specify the working directory. The built artifacts will be available in the mounted volume. ```bash docker run --rm -ti -v /path/to/omp/sources:/omp -w /omp open.mp/build:ubuntu-18.04 ``` -------------------------------- ### Run Docker Container for Build Source: https://github.com/openmultiplayer/open.mp/blob/master/docker/build_ubuntu-22.04/README.md Run the Docker container to build open.mp. Mounts local sources to the container and sets the working directory. The built executable will be available in the local sources directory. ```bash docker run --rm -ti -v /path/to/omp/sources:/omp -w /omp open.mp/build:ubuntu-22.04 ``` -------------------------------- ### Build Docker Image Source: https://github.com/openmultiplayer/open.mp/blob/master/docker/build_ubuntu-22.04/README.md Build the Docker image for open.mp on Ubuntu 22.04. This command tags the image as open.mp/build:ubuntu-22.04. ```bash docker build -t open.mp/build:ubuntu-22.04 . ``` -------------------------------- ### Build Docker Image Source: https://github.com/openmultiplayer/open.mp/blob/master/docker/build_ubuntu-20.04/README.md Build the Docker image for Open.mp compilation. This command tags the image as open.mp/build:ubuntu-20.04. ```docker docker build -t open.mp/build:ubuntu-20.04 . ``` -------------------------------- ### Add Server Component and Link Libraries Source: https://github.com/openmultiplayer/open.mp/blob/master/Server/Components/Recordings/CMakeLists.txt Defines a server component and links it with the ghc-filesystem library. This is typically used for setting up server-side modules. ```cmake get_filename_component(ProjectId ${CMAKE_CURRENT_SOURCE_DIR} NAME) add_server_component(${ProjectId}) target_link_libraries(${ProjectId} PRIVATE CONAN_PKG::ghc-filesystem ) ``` -------------------------------- ### Add Server Component and Link SQLite3 Source: https://github.com/openmultiplayer/open.mp/blob/master/Server/Components/Databases/CMakeLists.txt This snippet shows how to define a server component using its project ID and link it to the SQLite3 library via Conan. ```cmake get_filename_component(ProjectId ${CMAKE_CURRENT_SOURCE_DIR} NAME) add_server_component(${ProjectId}) target_link_libraries(${ProjectId} PRIVATE CONAN_PKG::sqlite3 ) ``` -------------------------------- ### Configure Database File Source: https://github.com/openmultiplayer/open.mp/blob/master/Server/Components/DatabasesTest/CMakeLists.txt Copies a database template file to the specified location for testing purposes. Ensures the test database is available at the expected path. ```cmake configure_file(test.db ../../../test.db COPYONLY) ``` -------------------------------- ### Add PAWN Runtime Library Source: https://github.com/openmultiplayer/open.mp/blob/master/lib/CMakeLists.txt Defines the PAWN runtime static library with specific compile options, include directories, and preprocessor definitions for different platforms. ```cmake set(PAWN_RUNTIME_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/pawn/source/amx") add_library(pawn-runtime STATIC ${PAWN_RUNTIME_SRC_DIR}/amx.c ${PAWN_RUNTIME_SRC_DIR}/amxargs.c ${PAWN_RUNTIME_SRC_DIR}/amxaux.c ${PAWN_RUNTIME_SRC_DIR}/amxcons.c ${PAWN_RUNTIME_SRC_DIR}/amxcore.c ${PAWN_RUNTIME_SRC_DIR}/amxfile.c ${PAWN_RUNTIME_SRC_DIR}/amxstring.c ${PAWN_RUNTIME_SRC_DIR}/amxtime.c ${PAWN_RUNTIME_SRC_DIR}/amxfloat.c ) target_compile_options(pawn-runtime PRIVATE "-Wno-unused-function" ) target_include_directories(pawn-runtime PRIVATE ${PAWN_RUNTIME_SRC_DIR} INTERFACE "${PAWN_RUNTIME_SRC_DIR}/.." ) include(CheckIncludeFile) check_include_file("unistd.h" HAVE_UNISTD_H) if(HAVE_UNISTD_H) target_compile_definitions(pawn-runtime PUBLIC -DHAVE_UNISTD_H) endif() check_include_file("inttypes.h" HAVE_INTTYPES_H) if(HAVE_INTTYPES_H) target_compile_definitions(pawn-runtime PUBLIC -DHAVE_INTTYPES_H) endif() check_include_file("stdint.h" HAVE_STDINT_H) if(HAVE_STDINT_H) target_compile_definitions(pawn-runtime PUBLIC -DHAVE_STDINT_H) endif() check_include_file("alloca.h" HAVE_ALLOCA_H) if(HAVE_ALLOCA_H) target_compile_definitions(pawn-runtime PUBLIC -DHAVE_ALLOCA_H) endif() if (MSVC) target_compile_definitions(pawn-runtime PRIVATE -D_CRT_SECURE_NO_WARNINGS ) endif() target_compile_definitions(pawn-runtime PRIVATE -DOVERWRITE_AMX_REGISTER -DFLOATPOINT -DAMX_STRING_LIB -DsNAMEMAX=63 -DPAWN_CELL_SIZE=32 -DAMX_FILENO_CHECKS -DAMX_NODYNALOAD # Disable default amx_FindPublic implementation because we want our own more performant one # Also disable amx_Allot because we want to check if we have enough memory when we are passing data # Which is more than available memory, so instead of a crash, we let user know about it. AMX_ALIGN AMX_CLEANUP AMX_CLONE AMX_DEFCALLBACK AMX_FLAGS AMX_GETADDR AMX_INIT AMX_MEMINFO AMX_NAMELENGTH AMX_NATIVEINFO AMX_PUSHXXX AMX_RAISEERROR AMX_REGISTER AMX_SETCALLBACK AMX_SETDEBUGHOOK AMX_XXXNATIVES AMX_XXXPUBVARS AMX_XXXSTRING AMX_XXXTAGS AMX_XXXUSERDATA AMX_UTF8XXX ) if(UNIX) # TODO: set fvisibility for gcc/clang target_compile_definitions(pawn-runtime PUBLIC -DLINUX) check_include_file("ffi.h" HAVE_FFI_H) target_include_directories(pawn-runtime PUBLIC "${PAWN_RUNTIME_SRC_DIR}/../linux") target_sources(pawn-runtime PRIVATE "${PAWN_RUNTIME_SRC_DIR}/../linux/getch.c") endif() if(WIN32) target_compile_definitions(pawn-runtime PRIVATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE ) target_link_libraries(pawn-runtime PRIVATE winmm) endif() set_property(TARGET pawn-runtime PROPERTY FOLDER "lib") set_property(TARGET pawn-runtime PROPERTY POSITION_INDEPENDENT_CODE ON) ``` -------------------------------- ### Add ghc-filesystem using Conan Source: https://github.com/openmultiplayer/open.mp/blob/master/lib/CMakeLists.txt Adds the ghc-filesystem library version 1.5.12 using the conan_omp_add_lib function. ```cmake conan_omp_add_lib(ghc-filesystem 1.5.12) ``` -------------------------------- ### Server Component CMake Configuration Source: https://github.com/openmultiplayer/open.mp/blob/master/Server/Components/NPCs/CMakeLists.txt Defines the project ID, includes necessary libraries, adds the server component, and links required libraries. ```cmake get_filename_component(ProjectId ${CMAKE_CURRENT_SOURCE_DIR} NAME) include_directories(${CMAKE_SOURCE_DIR}/lib/cpp-httplib) add_server_component(${ProjectId}) target_link_libraries(${ProjectId} PRIVATE CONAN_PKG::ghc-filesystem ) ``` -------------------------------- ### Run Docker Container for Build Source: https://github.com/openmultiplayer/open.mp/blob/master/docker/build_ubuntu-18.04/README.md Run a Docker container to build Open.MP. Mounts local source code into the container and sets the working directory. The build type can be configured using the CONFIG environment variable. ```docker docker run --rm -ti -v /path/to/omp/sources:/omp -w /omp open.mp/build:ubuntu-18.04 ``` ```docker docker run --rm -ti -v /path/to/omp/sources:/omp -w /omp -e CONFIG=Debug open.mp/build:ubuntu-18.04 ``` ```docker docker run --rm -ti -v /path/to/omp/sources:/omp -w /omp -e CONFIG=RelWithDebInfo open.mp/build:ubuntu-18.04 ``` -------------------------------- ### Configure Unicode Server Component Source: https://github.com/openmultiplayer/open.mp/blob/master/Server/Components/Unicode/CMakeLists.txt Sets up the server component for Unicode support, including conditional compile options and linking against the ICU library. ```cmake get_filename_component(ProjectId ${CMAKE_CURRENT_SOURCE_DIR} NAME) add_server_component(${ProjectId}) if (STATIC_STDCXX) # Remove any possible symbols from ICU, lower GLIBCXX version to 3.4.11 target_compile_options(${ProjectId} PRIVATE -fno-exceptions -fno-rtti) endif() target_link_libraries(${ProjectId} PRIVATE CONAN_PKG::icu ) ``` -------------------------------- ### Include Subdirectories Source: https://github.com/openmultiplayer/open.mp/blob/master/Server/CMakeLists.txt Includes the 'Source' and 'Components' subdirectories into the build. This allows for modular organization of the server's source code and components. ```cmake add_subdirectory(Source) add_subdirectory(Components) ``` -------------------------------- ### Add cxxopts using Conan Source: https://github.com/openmultiplayer/open.mp/blob/master/lib/CMakeLists.txt Adds the cxxopts library version 2.2.1 using the conan_omp_add_lib function. ```cmake conan_omp_add_lib(cxxopts 2.2.1) ``` -------------------------------- ### Include Directories Source: https://github.com/openmultiplayer/open.mp/blob/master/Server/Components/Pawn/CMakeLists.txt Specifies the include directories for the project, ensuring necessary headers are found. ```cmake include_directories(${CMAKE_SOURCE_DIR}/lib) ``` -------------------------------- ### Add Server Component and Link Libraries Source: https://github.com/openmultiplayer/open.mp/blob/master/Server/Components/CustomModels/CMakeLists.txt Configures a CMake project to add a server component and link necessary libraries. This is typically used at the top level of a component's directory. ```cmake get_filename_component(ProjectId ${CMAKE_CURRENT_SOURCE_DIR} NAME) add_server_component(${ProjectId}) include_directories(${CMAKE_SOURCE_DIR}/lib/cpp-httplib) target_link_libraries(${ProjectId} PRIVATE CONAN_PKG::ghc-filesystem ) ``` -------------------------------- ### Run Docker Container with Debug Build Source: https://github.com/openmultiplayer/open.mp/blob/master/docker/build_ubuntu-22.04/README.md Run the Docker container to build open.mp with the Debug configuration. Use this to enable debug symbols and optimizations for debugging purposes. ```bash docker run --rm -ti -e CONFIG=Debug -v /path/to/omp/sources:/omp -w /omp open.mp/build:ubuntu-22.04 ``` -------------------------------- ### Build Docker Image Source: https://github.com/openmultiplayer/open.mp/blob/master/docker/build_ubuntu-18.04/README.md Build the Docker image for Open.MP on Ubuntu 18.04. This command creates a local image tagged as open.mp/build:ubuntu-18.04. ```docker docker build -t open.mp/build:ubuntu-18.04 . ``` -------------------------------- ### Add SQLite3 using Conan with options Source: https://github.com/openmultiplayer/open.mp/blob/master/lib/CMakeLists.txt Adds the SQLite3 library version 3.36.0 using Conan, with an option to disable math functions. ```cmake conan_omp_add_lib_opt(sqlite3 3.36.0 "sqlite3:enable_math_functions=False") ``` -------------------------------- ### Clone open.mp Repository Source: https://github.com/openmultiplayer/open.mp/blob/master/README.md Clone the open.mp repository including submodules using HTTPS or SSH. ```bash # With HTTPS: git clone --recursive https://github.com/openmultiplayer/open.mp # With SSH: git clone --recursive git@github.com:openmultiplayer/open.mp ``` -------------------------------- ### Build Configuration Options Source: https://github.com/openmultiplayer/open.mp/blob/master/CMakeLists.txt Sets boolean cache variables to control which components of the project are built, such as server, PAWN, Unicode, legacy, test, SQLite, and fixes. ```cmake set(BUILD_SERVER TRUE CACHE BOOL "Whether to build the open.mp server") set(BUILD_PAWN_COMPONENT TRUE CACHE BOOL "Whether to build the PAWN component") set(BUILD_UNICODE_COMPONENT FALSE CACHE BOOL "Whether to build the Unicode component") set(BUILD_LEGACY_COMPONENTS TRUE CACHE BOOL "Whether to build the legacy components") set(BUILD_TEST_COMPONENTS FALSE CACHE BOOL "Whether to build the test component") set(BUILD_SQLITE_COMPONENT TRUE CACHE BOOL "Whether to build the SQLite component") set(BUILD_FIXES_COMPONENT FALSE CACHE BOOL "Whether to build the Fixes component") ``` -------------------------------- ### Specify Build Configuration for open.mp Source: https://github.com/openmultiplayer/open.mp/blob/master/docker/abicheck_ubuntu-18.04/README.md When running the Docker container, you can set the CONFIG environment variable to change the build type. Use 'Debug' for a debug build or 'RelWithDebInfo' for a release build with debug symbols. ```bash docker run --rm -ti -v /path/to/omp/sources:/omp -w /omp -e CONFIG=Debug open.mp/build:ubuntu-18.04 ``` ```bash docker run --rm -ti -v /path/to/omp/sources:/omp -w /omp -e CONFIG=RelWithDebInfo open.mp/build:ubuntu-18.04 ``` -------------------------------- ### Add Server Component Source: https://github.com/openmultiplayer/open.mp/blob/master/Server/Components/Fixes/CMakeLists.txt Adds a server component to the project. This is typically used at the top level of a component's CMakeLists.txt file. ```cmake get_filename_component(ProjectId ${CMAKE_CURRENT_SOURCE_DIR} NAME) add_server_component(${ProjectId}) ``` -------------------------------- ### Include Library Subdirectory Source: https://github.com/openmultiplayer/open.mp/blob/master/CMakeLists.txt Includes the 'lib' subdirectory, which likely contains library source files to be compiled. ```cmake add_subdirectory(lib) ``` -------------------------------- ### Enable C++ Extensions Source: https://github.com/openmultiplayer/open.mp/blob/master/Server/Components/Pawn/CMakeLists.txt Enables C++ extensions for the target project. ```cmake set_property(TARGET ${ProjectId} PROPERTY CXX_EXTENSIONS ON) ``` -------------------------------- ### Enable Compilation Database Generation Source: https://github.com/openmultiplayer/open.mp/blob/master/CMakeLists.txt Enables the generation of a compile_commands.json file, which is useful for code analysis tools. ```cmake set(CMAKE_EXPORT_COMPILE_COMMANDS ON) ``` -------------------------------- ### Add RakNet Subdirectory Source: https://github.com/openmultiplayer/open.mp/blob/master/lib/CMakeLists.txt Includes the RakNet library as a subdirectory and sets its folder property. Also applies specific compile options. ```cmake add_subdirectory(RakNet) set_property(TARGET raknet PROPERTY FOLDER "lib") target_compile_options(raknet PRIVATE "-Wno-logical-op-parentheses" "-Wno-bitwise-op-parentheses" "-Wno-#pragma-messages" ) ``` -------------------------------- ### Set Runtime Output Directory Source: https://github.com/openmultiplayer/open.mp/blob/master/Server/CMakeLists.txt Configures the runtime output directory for executables based on the build configuration (Debug, Release, etc.). This ensures executables are placed in the correct subfolder. ```cmake set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $,${CMAKE_BINARY_DIR}/Output/Debug/Server,$,${CMAKE_BINARY_DIR}/Output/Release/Server,$,${CMAKE_BINARY_DIR}/Output/RelWithDebInfo/Server,$,${CMAKE_BINARY_DIR}/Output/MinSizeRel/Server,${CMAKE_RUNTIME_OUTPUT_DIRECTORY}>>>> ) ``` -------------------------------- ### Add OpenSSL using Conan with options Source: https://github.com/openmultiplayer/open.mp/blob/master/lib/CMakeLists.txt Adds the OpenSSL library version 3.0.13 using Conan. It conditionally uses shared or static linking based on the SHARED_OPENSSL variable. ```cmake if(SHARED_OPENSSL) message("Using shared OpenSSL") conan_omp_add_lib_opt(openssl 3.0.13 "openssl:shared=True") else() message("Using static OpenSSL") conan_omp_add_lib(openssl 3.0.13) endif() ``` -------------------------------- ### Conditional Server and Tool Subdirectory Inclusion Source: https://github.com/openmultiplayer/open.mp/blob/master/CMakeLists.txt Conditionally includes subdirectories for the server components and the ABI check tool based on build configuration variables. ```cmake if(BUILD_SERVER) message("Configuring server") add_subdirectory(CAPI) add_subdirectory(SDK) add_subdirectory(Shared) add_subdirectory(Server) set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT Server) endif() if(BUILD_ABI_CHECK_TOOL) message("Configuring abi-check") add_subdirectory(Tools) endif() ``` -------------------------------- ### CMake Configuration for CAPI Component Source: https://github.com/openmultiplayer/open.mp/blob/master/Server/Components/CAPI/CMakeLists.txt Defines the CAPI component build in CMake. Sets the project ID, adds the server component, configures compile definitions and options, links necessary libraries, and sets target properties. ```cmake get_filename_component(ProjectId ${CMAKE_CURRENT_SOURCE_DIR} NAME) add_server_component(${ProjectId}) target_compile_definitions(${ProjectId} PRIVATE -DCAPI_COMPONENT_BUILD) target_compile_options(${ProjectId} PRIVATE -Wno-unused-variable) target_link_libraries(${ProjectId} PRIVATE OMP-CAPI) set_target_properties(${ProjectId} PROPERTIES PREFIX "$") ``` -------------------------------- ### Windows-Specific Definitions Source: https://github.com/openmultiplayer/open.mp/blob/master/CMakeLists.txt Adds definitions for Windows compilation to suppress warnings and enable specific features, including handling deprecated headers. ```cmake add_definitions( -D_CRT_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS -D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING -DWIN32_LEAN_AND_MEAN -D_CRT_DECLARE_NONSTDC_NAMES -D_CRT_NONSTDC_NO_WARNINGS -D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR ) ``` -------------------------------- ### Add libelfin using Conan Source: https://github.com/openmultiplayer/open.mp/blob/master/lib/CMakeLists.txt Adds the libelfin library version 0.3 using the conan_omp_add_lib function. ```cmake conan_omp_add_lib(libelfin 0.3) ``` -------------------------------- ### Conditional Build for ABI Check Tool on UNIX Source: https://github.com/openmultiplayer/open.mp/blob/master/CMakeLists.txt Sets a cache variable to determine whether the ABI check tool should be built, specifically for UNIX systems. ```cmake if (UNIX) set(BUILD_ABI_CHECK_TOOL TRUE CACHE BOOL "Whether to build the abi-check tool") endif() ``` -------------------------------- ### Add ttmath Subdirectory Source: https://github.com/openmultiplayer/open.mp/blob/master/lib/CMakeLists.txt Includes the ttmath library as a subdirectory and sets its folder property. It also groups sources by folder. ```cmake add_subdirectory(ttmath) GroupSourcesByFolder(ttmath) set_property(TARGET ttmath PROPERTY FOLDER "lib") ``` -------------------------------- ### Define Pawn Cell Size Source: https://github.com/openmultiplayer/open.mp/blob/master/Server/Components/Pawn/CMakeLists.txt Sets the C++ preprocessor definition for the Pawn cell size, typically to 32. ```cmake target_compile_definitions(${ProjectId} PRIVATE -DPAWN_CELL_SIZE=32 ) ``` -------------------------------- ### Add ICU using Conan Source: https://github.com/openmultiplayer/open.mp/blob/master/lib/CMakeLists.txt Adds the ICU library version 70.1 using Conan. Includes platform-specific link options for Windows. ```cmake conan_omp_add_lib(icu 70.1) if(WIN32) target_link_options(CONAN_PKG::icu INTERFACE "/SAFESEH:NO") endif() ``` -------------------------------- ### Add nlohmann_json using Conan Source: https://github.com/openmultiplayer/open.mp/blob/master/lib/CMakeLists.txt Adds the nlohmann_json library version 3.9.1 using the conan_omp_add_lib function. ```cmake conan_omp_add_lib(nlohmann_json 3.9.1) ``` -------------------------------- ### Set Debug Flags for C and C++ Source: https://github.com/openmultiplayer/open.mp/blob/master/CMakeLists.txt Defines preprocessor macros for debug builds to enable verbose logging and debugging information. ```cmake set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -D_DO_PRINTF") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -D_DO_PRINTF") ``` -------------------------------- ### Group Sources by Folder Function Source: https://github.com/openmultiplayer/open.mp/blob/master/CMakeLists.txt A CMake function to automatically group source files by their directory structure within the build system. ```cmake function(GroupSourcesByFolder target) set(SOURCE_GROUP_DELIMITER "/") set(last_dir "") set(files "") get_target_property(sources ${target} SOURCES) foreach(file ${sources}) file(RELATIVE_PATH relative_file "${CMAKE_CURRENT_SOURCE_DIR}" ${file}) get_filename_component(dir "${relative_file}" PATH) if(NOT "${dir}" STREQUAL "${last_dir}") if(files) source_group("${last_dir}" FILES ${files}) endif() set(files "") endif() set(files ${files} ${file}) set(last_dir "${dir}") endforeach() if(files) source_group("${last_dir}" FILES ${files}) endif() endfunction() ``` -------------------------------- ### GNU GCC Specific Definition Source: https://github.com/openmultiplayer/open.mp/blob/master/CMakeLists.txt Sets a specific definition for GNU GCC compiler to control the C++ Standard Library ABI version. ```cmake add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.