### Configuring Build Options for Tests, Examples, and Packages Source: https://github.com/objectcomputing/mfast/blob/master/CMakeLists.txt This section defines CMake options to control the building of tests, examples, and packages. These options allow users to selectively enable or disable these components during the build process, defaulting to 'ON'. ```CMake option(BUILD_TESTS "Build tests" ON) option(BUILD_EXAMPLES "Build examples" ON) option(BUILD_PACKAGES "Build packages" ON) ``` -------------------------------- ### Installing Project Schema Files Source: https://github.com/objectcomputing/mfast/blob/master/CMakeLists.txt This snippet uses file(GLOB) to find all files within the 'schema/' directory and then installs the entire directory to a standard data root directory, ensuring schema files are deployed with the application. ```CMake file(GLOB schema_files "${CMAKE_CURRENT_SOURCE_DIR}/schema/*.*") install(DIRECTORY schema/ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/mfast) ``` -------------------------------- ### Installing Static tinyxml2 Headers in CMake Source: https://github.com/objectcomputing/mfast/blob/master/src/mfast/xml_parser/CMakeLists.txt This command installs the public header files of the `tinyxml2_static` library. The headers are exported as part of `mFASTTargets`, making them discoverable by other CMake projects, and are placed in a specific subdirectory (`mfast/xml_parser`) under the install include directory. ```CMake install(TARGETS tinyxml2_static EXPORT mFASTTargets FILE_SET HEADERS DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mfast/xml_parser) ``` -------------------------------- ### Adding Hello World Subdirectory (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/examples/CMakeLists.txt This command adds the 'hello_world' directory to the CMake build. This typically includes a basic example application, useful for verifying the build environment and demonstrating fundamental project structure. ```CMake add_subdirectory (hello_world) ``` -------------------------------- ### Configuring and Installing mFAST SQLite3 Static Library - CMake Source: https://github.com/objectcomputing/mfast/blob/master/src/mfast/sqlite3/CMakeLists.txt This section defines and configures the `mfast_sqlite3_static` library. It adds source and header files, sets a public compile definition, links against `mfast_static` and `SQLite::SQLite3`, and renames the output on Unix systems. Finally, it sets up the installation rules for the static library and its headers. ```CMake add_library(mfast_sqlite3_static STATIC) target_sources(mfast_sqlite3_static PRIVATE ${sources}) target_sources(mfast_sqlite3_static PUBLIC FILE_SET HEADERS BASE_DIRS ${PROJECT_SOURCE_DIR}/src/ FILES ${headers}) target_compile_definitions(mfast_sqlite3_static PUBLIC MFAST_SQLITE3_STATIC_DEFINE) target_link_libraries(mfast_sqlite3_static mfast_static SQLite::SQLite3) if (UNIX) set_target_properties(mfast_sqlite3_static PROPERTIES OUTPUT_NAME mfast_sqlite3) endif() install(TARGETS mfast_sqlite3_static EXPORT mFASTTargets FILE_SET HEADERS OPTIONAL) ``` -------------------------------- ### Adding Source and Conditional Test/Example Subdirectories Source: https://github.com/objectcomputing/mfast/blob/master/CMakeLists.txt This snippet adds the main 'src' directory to the build. It also conditionally includes 'tests' and 'examples' subdirectories based on the BUILD_TESTS and BUILD_EXAMPLES options, enabling modular compilation. ```CMake add_subdirectory (src) if(BUILD_TESTS) enable_testing() add_subdirectory (tests) endif(BUILD_TESTS) if(BUILD_EXAMPLES) add_subdirectory (examples) endif(BUILD_EXAMPLES) ``` -------------------------------- ### Installing Static mfast_xml_parser Library in CMake Source: https://github.com/objectcomputing/mfast/blob/master/src/mfast/xml_parser/CMakeLists.txt This command installs the `mfast_xml_parser_static` library, including its public headers. It exports the target as part of `mFASTTargets`, making it discoverable and usable by other CMake projects that depend on mFAST. ```CMake install(TARGETS mfast_xml_parser_static EXPORT mFASTTargets FILE_SET HEADERS) ``` -------------------------------- ### Configuring and Installing mFAST SQLite3 Shared Library - CMake Source: https://github.com/objectcomputing/mfast/blob/master/src/mfast/sqlite3/CMakeLists.txt This conditional block, active only if `BUILD_SHARED_LIBS` is true, configures the `mfast_sqlite3` shared library. It adds sources and headers, defines `MFAST_DYN_LINK`, links against `mfast` and `SQLite::SQLite3`, and sets version properties. It then defines installation rules for the shared library and its headers. ```CMake if (BUILD_SHARED_LIBS) add_library(mfast_sqlite3 SHARED) target_sources(mfast_sqlite3 PRIVATE ${sources}) target_sources(mfast_sqlite3 PUBLIC FILE_SET HEADERS BASE_DIRS ${PROJECT_SOURCE_DIR}/src/ FILES ${headers}) target_compile_definitions(mfast_sqlite3 PUBLIC MFAST_DYN_LINK) target_link_libraries(mfast_sqlite3 mfast SQLite::SQLite3) set_property(TARGET mfast_sqlite3 PROPERTY VERSION ${MFAST_VERSION}) set_property(TARGET mfast_sqlite3 PROPERTY SOVERSION ${MFAST_VERSION}) install(TARGETS mfast_sqlite3 EXPORT mFASTTargets FILE_SET HEADERS OPTIONAL) endif (BUILD_SHARED_LIBS) ``` -------------------------------- ### Building mFAST on Unix/macOS using CMake Source: https://github.com/objectcomputing/mfast/blob/master/ReadMe.md This snippet provides the standard command-line steps to clone, configure, and build the mFAST library on Unix or macOS systems. It assumes Boost library is already installed and accessible on system paths. The process involves cloning the repository, creating a build directory, navigating into it, running CMake for configuration, and then using make to compile the project. ```bash git clone --recursive https://github.com/objectcomputing/mFAST.git mkdir mFAST/build cd mFAST/build cmake .. make ``` -------------------------------- ### Configuring and Installing mFAST Static Library (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/src/mfast/CMakeLists.txt This section defines and configures the `mfast_static` library as a static library. It specifies private source files, public header files, sets a public compile definition (`MFAST_STATIC_DEFINE`), enforces C++14 standard, and links against Boost headers. It also conditionally renames the output on UNIX systems and configures its installation. ```CMake add_library(mfast_static STATIC) target_sources(mfast_static PRIVATE ${sources} ${instruction_sources}) target_sources(mfast_static PUBLIC FILE_SET HEADERS BASE_DIRS ${PROJECT_SOURCE_DIR}/src FILES ${headers} ${instruction_headers}) target_compile_definitions(mfast_static PUBLIC MFAST_STATIC_DEFINE) target_compile_features(mfast_static PUBLIC cxx_std_14) target_link_libraries(mfast_static PUBLIC Boost::headers) if (UNIX) set_target_properties(mfast_static PROPERTIES OUTPUT_NAME mfast) endif() install(TARGETS mfast_static EXPORT mFASTTargets FILE_SET HEADERS) ``` -------------------------------- ### Including Standard and Custom CMake Modules Source: https://github.com/objectcomputing/mfast/blob/master/CMakeLists.txt This snippet includes several standard CMake modules like GNUInstallDirs, Emscripten, and custom project-specific modules for compiler warnings, coverage setup, and FastTypeGen target generation. ```CMake include(GNUInstallDirs) include(Emscripten) include(SetCompilerWarnings) include(SetupCoverage) include(FastTypeGenTarget) ``` -------------------------------- ### Configuring and Installing mFAST Shared Library (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/src/mfast/CMakeLists.txt This conditional block, executed only if `BUILD_SHARED_LIBS` is true, defines and configures the `mfast` library as a shared library. It uses the same source and header files as the static library, enforces C++14, adds an interface compile definition (`MFAST_DYN_LINK`), links Boost, and sets version properties. Finally, it configures the shared library for installation. ```CMake if (BUILD_SHARED_LIBS) add_library(mfast SHARED) target_sources(mfast PRIVATE ${sources} ${instruction_sources}) target_sources(mfast PUBLIC FILE_SET HEADERS BASE_DIRS ${PROJECT_SOURCE_DIR}/src FILES ${headers} ${instruction_headers}) target_compile_features(mfast PUBLIC cxx_std_14) target_compile_definitions(mfast INTERFACE MFAST_DYN_LINK) target_link_libraries(mfast PUBLIC Boost::headers) set_property(TARGET mfast PROPERTY VERSION ${MFAST_VERSION}) set_property(TARGET mfast PROPERTY SOVERSION ${MFAST_VERSION}) install(TARGETS mfast EXPORT mFASTTargets FILE_SET HEADERS) endif () ``` -------------------------------- ### Configuring CPack for Package Generation Source: https://github.com/objectcomputing/mfast/blob/master/CMakeLists.txt This conditional block configures CPack for creating installation packages. It sets the default generator to 'DEB' and allows for a custom installation prefix, defining various package metadata like name, version, and vendor. ```CMake if(BUILD_PACKAGES) # Build deb package by default if(NOT CPACK_GENERATOR) set(CPACK_GENERATOR "DEB" CACHE STRING "List of generators.") endif(NOT CPACK_GENERATOR) if(CUSTOM_INSTALL_PREFIX) set(CMAKE_INSTALL_PREFIX ${CUSTOM_INSTALL_PREFIX} CACHE STRING "Custom installation prefix.") set(CPACK_SET_DESTDIR true) set(CPACK_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) endif(CUSTOM_INSTALL_PREFIX) set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A FAST (FIX Adapted for STreaming) encoder/decoder") set(CPACK_PACKAGE_NAME "mfast") set(CPACK_PACKAGE_VERSION ${MFAST_VERSION}) set(CPACK_PACKAGE_VENDOR "Object Computing, Inc.") set(CPACK_PACKAGE_CONTACT "info@ociweb.com") set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Huang-Ming Huang") set(CPACK_DEBIAN_PACKAGE_SECTION "devel") include(CPack) endif(BUILD_PACKAGES) ``` -------------------------------- ### Configuring and Installing Static Library in CMake Source: https://github.com/objectcomputing/mfast/blob/master/src/mfast/json/CMakeLists.txt This block defines a static library named `mfast_json_static`. It specifies private source files and public header files using `FILE_SET HEADERS`. The library links against `mfast_static` and defines `MFAST_JSON_STATIC_DEFINE`. On UNIX systems, its output name is set to `mfast_json`. Finally, the static library and its headers are configured for installation. ```CMake add_library(mfast_json_static STATIC) target_sources(mfast_json_static PRIVATE ${sources}) target_sources(mfast_json_static PUBLIC FILE_SET HEADERS BASE_DIRS ${PROJECT_SOURCE_DIR}/src FILES ${headers}) target_link_libraries(mfast_json_static PUBLIC mfast_static) target_compile_definitions(mfast_json_static PUBLIC MFAST_JSON_STATIC_DEFINE) if (UNIX) set_target_properties(mfast_json_static PROPERTIES OUTPUT_NAME mfast_json) endif() install(TARGETS mfast_json_static EXPORT mFASTTargets FILE_SET HEADERS) ``` -------------------------------- ### Setting Properties and Installing mFAST Type Generator (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/src/fast_type_gen/CMakeLists.txt This snippet sets the `VERSION` property for the `fast_type_gen` executable using the `mFAST_VERSION` variable. It then configures the installation of the executable, ensuring it's exported as part of `mFASTTargets` for use by other projects. ```CMake set_target_properties(fast_type_gen PROPERTIES VERSION ${mFAST_VERSION}) install(TARGETS fast_type_gen EXPORT mFASTTargets) ``` -------------------------------- ### Defining a CMake Test Executable Function (Commented) Source: https://github.com/objectcomputing/mfast/blob/master/tests/CMakeLists.txt This commented-out CMake function defines a reusable pattern for adding test executables. It compiles a C++ source file and links it against `mfast_static` and `Boost_UNIT_TEST_FRAMEWORK_LIBRARY`. Although commented, it shows an intended modular approach for test setup. ```CMake function(add_test_executable executable_name) add_executable (${executable_name} ${executable_name}.cpp) target_link_libraries (${executable_name} mfast_static ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) endfunction(add_test_executable) ``` -------------------------------- ### Adding Custom Install Target and Exporting mFAST Type Generator (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/src/fast_type_gen/CMakeLists.txt This section creates a custom CMake target `install.fast_type_gen` to facilitate the installation process, depending on the `fast_type_gen` executable. Finally, it exports the `fast_type_gen` target to `mFASTTypeGenConfig.cmake` in the binary directory, making it discoverable for other builds, especially cross-compiling ones. ```CMake add_custom_target(install.fast_type_gen COMMAND ${CMAKE_COMMAND} -DBUILD_TYPE=${CMAKE_BUILD_TYPE} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake DEPENDS fast_type_gen) # export the host-built fast_type_gen to the binary tree, to be used from another cross-compiling build export(TARGETS fast_type_gen FILE ${CMAKE_BINARY_DIR}/mFASTTypeGenConfig.cmake) endif() ``` -------------------------------- ### Defining FASTTYPEGEN Target for XML Template (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/examples/performance_test/CMakeLists.txt This line invokes the `FASTTYPEGEN_TARGET` macro, which is likely a custom CMake macro for generating C++ code from an XML template. It specifies 'example' as the target name and 'example.xml' as the input template file, generating necessary source files for the mFAST project. ```CMake FASTTYPEGEN_TARGET(example example.xml) ``` -------------------------------- ### Configuring Static mFAST Coder Library (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/src/mfast/coder/CMakeLists.txt This block defines and configures the 'mfast_coder_static' library. It adds private source files, public header files, links against 'mfast_static', and defines a preprocessor macro for static linking. It also sets the output name for Unix systems and handles installation. ```CMake add_library(mfast_coder_static STATIC) target_sources(mfast_coder_static PRIVATE ${sources}) target_sources(mfast_coder_static PUBLIC FILE_SET HEADERS BASE_DIRS ${PROJECT_SOURCE_DIR}/src/ FILES ${headers}) target_link_libraries(mfast_coder_static PUBLIC mfast_static) target_compile_definitions(mfast_coder_static PUBLIC MFAST_CODER_STATIC_DEFINE) if (UNIX) set_target_properties(mfast_coder_static PROPERTIES OUTPUT_NAME mfast_coder) endif() install(TARGETS mfast_coder_static EXPORT mFASTTargets FILE_SET HEADERS) ``` -------------------------------- ### Configuring and Installing Shared Library in CMake Source: https://github.com/objectcomputing/mfast/blob/master/src/mfast/json/CMakeLists.txt This conditional block, executed only if `BUILD_SHARED_LIBS` is true, defines a shared library named `mfast_json`. It includes private sources and public headers, links against `mfast`, and adds the `MFAST_DYN_LINK` interface definition. The library's version and SOVERSION properties are set. Finally, the shared library and its headers are configured for installation. ```CMake if (BUILD_SHARED_LIBS) add_library(mfast_json SHARED) target_sources(mfast_json PRIVATE ${sources}) target_sources(mfast_json PUBLIC FILE_SET HEADERS BASE_DIRS ${PROJECT_SOURCE_DIR}/src FILES ${headers}) target_link_libraries(mfast_json PUBLIC mfast) target_compile_definitions(mfast_json INTERFACE MFAST_DYN_LINK) set_property(TARGET mfast_json PROPERTY VERSION ${MFAST_VERSION}) set_property(TARGET mfast_json PROPERTY SOVERSION ${MFAST_VERSION}) install(TARGETS mfast_json EXPORT mFASTTargets FILE_SET HEADERS) endif (BUILD_SHARED_LIBS) ``` -------------------------------- ### Configuring Shared mFAST Coder Library (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/src/mfast/coder/CMakeLists.txt This conditional block defines and configures the 'mfast_coder' shared library if 'BUILD_SHARED_LIBS' is enabled. It includes additional source files, sets public headers, defines a dynamic link macro, links against 'mfast', sets version properties, and handles installation. ```CMake if (BUILD_SHARED_LIBS) add_library(mfast_coder SHARED) target_sources(mfast_coder PRIVATE ${sources} decoder_v2/fast_decoder_core.cpp) target_sources(mfast_coder PUBLIC FILE_SET HEADERS BASE_DIRS ${PROJECT_SOURCE_DIR}/src/ FILES ${headers}) target_compile_definitions(mfast_coder INTERFACE MFAST_DYN_LINK) target_link_libraries(mfast_coder PUBLIC mfast) set_property(TARGET mfast_coder PROPERTY VERSION ${MFAST_VERSION}) set_property(TARGET mfast_coder PROPERTY SOVERSION ${MFAST_VERSION}) install(TARGETS mfast_coder EXPORT mFASTTargets FILE_SET HEADERS) endif (BUILD_SHARED_LIBS) ``` -------------------------------- ### Conditional Shared Library Build for mFAST XML Parser in CMake Source: https://github.com/objectcomputing/mfast/blob/master/src/mfast/xml_parser/CMakeLists.txt This block conditionally builds shared libraries for tinyxml2 and mfast_xml_parser if the `BUILD_SHARED_LIBS` CMake option is enabled. It includes setting position-independent code for shared objects and defining version properties for the shared mFAST XML parser library, along with its installation. ```CMake if (BUILD_SHARED_LIBS) add_library(tinyxml2_shared OBJECT) target_sources(tinyxml2_shared PRIVATE ${TINYXML2_ROOT}/tinyxml2.cpp) target_sources(tinyxml2_shared PUBLIC FILE_SET HEADERS BASE_DIRS ${TINYXML2_ROOT} FILES ${TINYXML2_ROOT}/tinyxml2.h) set_property(TARGET tinyxml2_shared PROPERTY POSITION_INDEPENDENT_CODE ON) add_library(mfast_xml_parser SHARED) target_sources(mfast_xml_parser PRIVATE ${sources}) target_sources(mfast_xml_parser PUBLIC FILE_SET HEADERS BASE_DIRS ${PROJECT_SOURCE_DIR}/src FILES ${headers}) target_compile_definitions(mfast_xml_parser INTERFACE MFAST_DYN_LINK) target_link_libraries(mfast_xml_parser PUBLIC mfast PRIVATE tinyxml2_shared) set_property(TARGET mfast_xml_parser PROPERTY VERSION ${MFAST_VERSION}) set_property(TARGET mfast_xml_parser PROPERTY SOVERSION ${MFAST_VERSION}) install(TARGETS mfast_xml_parser EXPORT mFASTTargets FILE_SET HEADERS) endif (BUILD_SHARED_LIBS) ``` -------------------------------- ### Basic mFAST CMake Configuration Source: https://github.com/objectcomputing/mfast/blob/master/examples/message_printer/CMakeLists.txt This snippet shows the fundamental CMake commands for setting up an mFAST project. It specifies the minimum CMake version, finds the mFAST package with the 'coder' component, and includes the necessary mFAST header and library directories for compilation and linking. ```CMake cmake_minimum_required(VERSION 2.8) find_package(mFAST REQUIRED COMPONENTS coder) include_directories(${MFAST_INCLUDE_DIR}) link_directories(${MFAST_LIBRARY_DIRS}) ``` -------------------------------- ### Displaying Final Build Configuration Summary Source: https://github.com/objectcomputing/mfast/blob/master/CMakeLists.txt This snippet prints a summary of key CMake variables and build options to the console. This provides a quick overview of the configured environment, compiler, and enabled features after CMake processing. ```CMake message(STATUS "") message(STATUS "CMAKE_COMMAND: " ${CMAKE_COMMAND}) message(STATUS "CMAKE_SYSTEM: " ${CMAKE_SYSTEM}) message(STATUS "CMAKE_SYSTEM_PROCESSOR: " ${CMAKE_SYSTEM_PROCESSOR}) message(STATUS "CMAKE_CXX_COMPILER: " ${CMAKE_CXX_COMPILER}) message(STATUS "CMAKE_CXX_FLAGS: " ${CMAKE_CXX_FLAGS}) message(STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE}) message(STATUS "BUILD_SHARED_LIBS: " ${BUILD_SHARED_LIBS}) message(STATUS "BUILD_TESTS: " ${BUILD_TESTS}) message(STATUS "BUILD_EXAMPLES: " ${BUILD_EXAMPLES}) message(STATUS "BUILD_PACKAGES: " ${BUILD_PACKAGES}) message(STATUS "") ``` -------------------------------- ### Defining Executable and Linking mFAST Libraries in CMake Source: https://github.com/objectcomputing/mfast/blob/master/examples/hello_world/CMakeLists.txt This CMake snippet defines an executable named 'hello_world' from its source file 'hello_world.cpp'. It then links the executable against several static mFAST libraries, including 'mfast_coder_static', 'mfast_json_static', and 'mfast_xml_parser_static', which are essential for mFAST application functionality. ```CMake add_executable (hello_world hello_world.cpp) target_link_libraries (hello_world mfast_coder_static mfast_json_static mfast_xml_parser_static) ``` -------------------------------- ### Initializing CMake Project with Version and Language Source: https://github.com/objectcomputing/mfast/blob/master/CMakeLists.txt This snippet sets the minimum required CMake version and defines the project name, version, and the primary language (CXX) for the mFAST project. It's the foundational step for any CMake project. ```CMake cmake_minimum_required(VERSION 3.23) project (mFAST VERSION 1.3.0 LANGUAGES CXX) ``` -------------------------------- ### Discovering Source and Header Files (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/src/mfast/CMakeLists.txt This snippet uses the `file(GLOB ...)` command to discover header and source files within the current directory and a specified 'instructions' subdirectory. It then appends an additional header file (`../mfast.h`) to the collected headers list. This is a prerequisite for defining library sources. ```CMake file (GLOB headers CONFIGURE_DEPENDS "*.h" ) ## retrieve all header files in current directory file (GLOB sources CONFIGURE_DEPENDS "*.cpp" ) ## retrieve all source files in current directory file (GLOB instruction_headers CONFIGURE_DEPENDS "instructions/*.h") ## retrieve all header files in instructions directory file (GLOB instruction_sources CONFIGURE_DEPENDS "instructions/*.cpp") ## retrieve all source files in instructions directory list(APPEND headers ../mfast.h) ``` -------------------------------- ### Finding SQLite3 Package and Globbing Source Files - CMake Source: https://github.com/objectcomputing/mfast/blob/master/src/mfast/sqlite3/CMakeLists.txt This snippet initializes the CMake build by finding the required SQLite3 package and then uses `file(GLOB)` to discover all header (`.h`) and source (`.cpp`) files in the current directory. `CONFIGURE_DEPENDS` ensures that CMake re-runs configuration if these file lists change. ```CMake find_package(SQLite3 REQUIRED) file (GLOB headers CONFIGURE_DEPENDS "*.h") ## retrieve all header files in current directory file (GLOB sources CONFIGURE_DEPENDS "*.cpp") ## retrieve all source files in current directory ``` -------------------------------- ### Adding Fixed Template Decode Executable (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/examples/performance_test/CMakeLists.txt This snippet defines an executable `mf_fixed_decode` for fixed template decoding. It uses the output files generated by `FASTTYPEGEN_example_OUTPUTS` (from `example.xml`) and `fixed_template_test.cpp`, linking against the core mFAST libraries for its functionality. ```CMake add_executable (mf_fixed_decode ${FASTTYPEGEN_example_OUTPUTS} fixed_template_test.cpp) target_link_libraries (mf_fixed_decode ${TEST_LIBS} ) ``` -------------------------------- ### Building mFAST Application with FASTTYPEGEN Source: https://github.com/objectcomputing/mfast/blob/master/examples/message_printer/CMakeLists.txt This snippet demonstrates how to build an mFAST application using CMake. It utilizes `FASTTYPEGEN_TARGET` to generate code from an XML schema, defines an executable named 'message_printer' using the generated outputs and a source file, and links it against the static mFAST library. ```CMake FASTTYPEGEN_TARGET(MDRefreshSample MDRefreshSample.xml) add_executable (message_printer ${FASTTYPEGEN_MDRefreshSample_OUTPUTS} message_printer.cpp) target_link_libraries (message_printer mfast_static) ``` -------------------------------- ### Configuring mFAST Dependencies in CMake Source: https://github.com/objectcomputing/mfast/blob/master/examples/hello_world/CMakeLists.txt This CMake snippet demonstrates how to find the mFAST package and include its necessary directories and libraries. It specifies a minimum CMake version and requires the 'coder' component of mFAST, setting up the build environment for mFAST applications. ```CMake cmake_minimum_required(VERSION 2.8) find_package(mFAST REQUIRED COMPONENTS coder) include_directories(${MFAST_INCLUDE_DIR}) link_directories(${MFAST_LIBRARY_DIRS}) ``` -------------------------------- ### Decoding Data with mf_generic_decode (Shell) Source: https://github.com/objectcomputing/mfast/blob/master/examples/performance_test/ReadMe.txt This command utilizes the `mf_generic_decode` tool to process a data file. It requires a template XML file (`example.xml`) and the data file (`complex30000.dat`), applying a header fix of 4 bytes. This is typically used for general-purpose data decoding in performance tests. ```Shell mf_generic_decode -t example.xml -f complex30000.dat -hfix 4 ``` -------------------------------- ### Setting Core Library and File Variables (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/examples/performance_test/CMakeLists.txt This snippet initializes CMake variables for common libraries and data/template files used throughout the project. `TEST_LIBS` defines the core mFAST static libraries, while `DATA_FILE` and `TEMPLATE_FILE` specify the names of the data and XML template files, respectively. ```CMake set(TEST_LIBS mfast_static mfast_coder_static mfast_xml_parser_static) set(DATA_FILE "complex30000.dat") set(TEMPLATE_FILE "example.xml") ``` -------------------------------- ### Adding Fixed Template Decode v2 Executable (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/examples/performance_test/CMakeLists.txt This snippet defines `mf_fixed_decode_v2`, an executable for a second version of fixed template decoding, using `fixed_template_test_v2.cpp` and `FASTTYPEGEN_example_OUTPUTS`. It establishes a dependency on `mf_fixed_decode_encode` and links the standard mFAST libraries. ```CMake add_executable (mf_fixed_decode_v2 ${FASTTYPEGEN_example_OUTPUTS} fixed_template_test_v2.cpp) add_dependencies(mf_fixed_decode_v2 mf_fixed_decode_encode) target_link_libraries (mf_fixed_decode_v2 ${TEST_LIBS} ) ``` -------------------------------- ### Creating Static mfast_xml_parser Library in CMake Source: https://github.com/objectcomputing/mfast/blob/master/src/mfast/xml_parser/CMakeLists.txt This section defines the static library for `mfast_xml_parser`. It includes all previously collected source and header files, links against the `mfast_static` and `tinyxml2_static` libraries, and defines a public compile definition (`MFAST_CODER_STATIC_DEFINE`) necessary for static linking. ```CMake add_library(mfast_xml_parser_static STATIC) target_sources(mfast_xml_parser_static PRIVATE ${sources}) target_sources(mfast_xml_parser_static PUBLIC FILE_SET HEADERS BASE_DIRS ${PROJECT_SOURCE_DIR}/src FILES ${headers}) target_link_libraries(mfast_xml_parser_static PUBLIC mfast_static tinyxml2_static) target_compile_definitions(mfast_xml_parser_static PUBLIC MFAST_CODER_STATIC_DEFINE) ``` -------------------------------- ### Adding Generic Template Decode Executable (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/examples/performance_test/CMakeLists.txt This snippet defines an executable target `mf_generic_decode` using `generic_template_test.cpp`. It links against the `TEST_LIBS` (mFAST static libraries) to enable generic FAST message decoding functionality. The commented line indicates an optional dependency on Boost for time measurement. ```CMake add_executable (mf_generic_decode generic_template_test.cpp) target_link_libraries (mf_generic_decode # ${Boost_SYSTEM_LIBRARY} # only necessary when boost::chrono is used for measuring time ${TEST_LIBS}) ``` -------------------------------- ### Adding Generic Template Decode/Encode Executable (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/examples/performance_test/CMakeLists.txt This snippet creates an executable `mf_generic_decode_encode` from `generic_template_test.cpp`. It sets a compile flag `-DWITH_ENCODE` to enable encoding capabilities in addition to decoding, and links the necessary mFAST libraries defined in `TEST_LIBS`. ```CMake add_executable (mf_generic_decode_encode generic_template_test.cpp) set_target_properties(mf_generic_decode_encode PROPERTIES COMPILE_FLAGS -DWITH_ENCODE) target_link_libraries (mf_generic_decode_encode ${TEST_LIBS}) ``` -------------------------------- ### Configuring Emscripten-Specific Build Settings (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/examples/performance_test/CMakeLists.txt This conditional block adjusts CMake settings based on the target system. If compiling for Emscripten, it sets the executable suffix to `.html`, copies data files, and preloads them into the build, defining their paths relative to the binary directory. Otherwise, it defines the file paths relative to the source directory for other systems. ```CMake if (${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten") # SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}" ) # SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}" ) set(CMAKE_EXECUTABLE_SUFFIX ".html") file(COPY ${DATA_FILE} ${TEMPLATE_FILE} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --preload-file ${DATA_FILE} --preload-file ${TEMPLATE_FILE}") set_property( DIRECTORY PROPERTY COMPILE_DEFINITIONS DATA_FILE=\"${DATA_FILE}\" TEMPLATE_FILE=\"${TEMPLATE_FILE}\"; ) else() set_property( DIRECTORY PROPERTY COMPILE_DEFINITIONS DATA_FILE=\"${CMAKE_CURRENT_SOURCE_DIR}/${DATA_FILE}\" TEMPLATE_FILE=\"${CMAKE_CURRENT_SOURCE_DIR}/${TEMPLATE_FILE}\"; ) endif(${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten") ``` -------------------------------- ### Linking Libraries for mFAST Test Executable Source: https://github.com/objectcomputing/mfast/blob/master/tests/CMakeLists.txt This command links the `mfast_test` executable against several static mFAST libraries: `mfast_static`, `mfast_coder_static`, `mfast_json_static`, and `mfast_xml_parser_static`. These dependencies provide the core functionality required for the test suite to operate correctly. ```CMake target_link_libraries (mfast_test mfast_static mfast_coder_static mfast_json_static mfast_xml_parser_static) ``` -------------------------------- ### Including Catch Test Framework Headers Source: https://github.com/objectcomputing/mfast/blob/master/tests/CMakeLists.txt This line adds the `catch/include` directory to the project's include paths, making the Catch C++ testing framework headers available for compilation. This is a prerequisite for using Catch in the test suite. ```CMake include_directories(${PROJECT_SOURCE_DIR}/catch/include) ``` -------------------------------- ### Finding Required Boost Dependency Source: https://github.com/objectcomputing/mfast/blob/master/CMakeLists.txt This command attempts to locate the Boost library with a minimum version of 1.56.0. The REQUIRED keyword ensures that CMake will fail if Boost is not found, indicating a critical dependency. ```CMake find_package(Boost 1.56.0 REQUIRED) ``` -------------------------------- ### Adding Fixed Template Decode/Encode v2 Executable (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/examples/performance_test/CMakeLists.txt This snippet creates `mf_fixed_decode_encode_v2`, enabling both decoding and encoding for the second version of fixed templates. It uses `fixed_template_test_v2.cpp`, sets the `-DWITH_ENCODE` flag, depends on `mf_fixed_decode_v2`, and links the necessary mFAST libraries. ```CMake add_executable (mf_fixed_decode_encode_v2 ${FASTTYPEGEN_example_OUTPUTS} fixed_template_test_v2.cpp) set_target_properties(mf_fixed_decode_encode_v2 PROPERTIES COMPILE_FLAGS -DWITH_ENCODE) add_dependencies(mf_fixed_decode_encode_v2 mf_fixed_decode_v2) target_link_libraries (mf_fixed_decode_encode_v2 ${TEST_LIBS} ) ``` -------------------------------- ### Generating Simple FAST Types from XML Schemas Source: https://github.com/objectcomputing/mfast/blob/master/tests/CMakeLists.txt These commands use the `FASTTYPEGEN_TARGET` macro to generate C++ code for simple FAST types based on a series of `simpleX.xml` schema definitions. Each call creates a target that processes a specific XML file, producing C++ output used in the test suite. ```CMake FASTTYPEGEN_TARGET(simple_types1 simple1.xml) FASTTYPEGEN_TARGET(simple_types2 simple2.xml) FASTTYPEGEN_TARGET(simple_types3 simple3.xml) FASTTYPEGEN_TARGET(simple_types4 simple4.xml) FASTTYPEGEN_TARGET(simple_types5 simple5.xml) FASTTYPEGEN_TARGET(simple_types6 simple6.xml) FASTTYPEGEN_TARGET(simple_types7 simple7.xml) FASTTYPEGEN_TARGET(simple_types8 simple8.xml) FASTTYPEGEN_TARGET(simple_types9 simple9.xml) FASTTYPEGEN_TARGET(simple_types10 simple10.xml) FASTTYPEGEN_TARGET(simple_types11 simple11.xml) FASTTYPEGEN_TARGET(simple_types12 simple12.xml) FASTTYPEGEN_TARGET(simple_types13 simple13.xml) FASTTYPEGEN_TARGET(simple_types14 simple14.xml) FASTTYPEGEN_TARGET(simple_types15 simple15.xml) ``` -------------------------------- ### Adding Performance Test Subdirectory (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/examples/CMakeLists.txt This command includes the 'performance_test' directory in the CMake build system. It ensures that the CMakeLists.txt file within 'performance_test' is processed, typically for building performance-related executables or libraries. ```CMake add_subdirectory (performance_test) ``` -------------------------------- ### Adding Fixed Template Decode/Encode Executable (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/examples/performance_test/CMakeLists.txt This snippet creates `mf_fixed_decode_encode` for fixed template decoding and encoding, using the same source files as `mf_fixed_decode`. It enables encoding via `COMPILE_FLAGS -DWITH_ENCODE`, adds a dependency on `mf_fixed_decode`, and links the required mFAST libraries. ```CMake add_executable (mf_fixed_decode_encode ${FASTTYPEGEN_example_OUTPUTS} fixed_template_test.cpp) set_target_properties(mf_fixed_decode_encode PROPERTIES COMPILE_FLAGS -DWITH_ENCODE) add_dependencies(mf_fixed_decode_encode mf_fixed_decode) target_link_libraries (mf_fixed_decode_encode ${TEST_LIBS} ) ``` -------------------------------- ### Creating Static tinyxml2 Object Library in CMake Source: https://github.com/objectcomputing/mfast/blob/master/src/mfast/xml_parser/CMakeLists.txt This block defines an `OBJECT` library named `tinyxml2_static`. An OBJECT library compiles source files but does not link them into a final library, instead providing object files that can be linked into other targets. It specifies the private source file (`tinyxml2.cpp`) and public header files for the library. ```CMake add_library(tinyxml2_static OBJECT) target_sources(tinyxml2_static PRIVATE ${TINYXML2_ROOT}/tinyxml2.cpp) target_sources(tinyxml2_static PUBLIC FILE_SET HEADERS BASE_DIRS ${TINYXML2_ROOT} FILES ${TINYXML2_ROOT}/tinyxml2.h) ``` -------------------------------- ### Retrieving Source and Header Files (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/src/fast_type_gen/CMakeLists.txt This snippet, executed during native compilation, uses `file (GLOB ...)` to find all header (`.h`) and source (`.cpp`) files in the current directory. These files are then used to define the sources for the `fast_type_gen` executable. ```CMake else() file (GLOB headers CONFIGURE_DEPENDS "*.h") ## retrieve all header files in current directory file (GLOB sources CONFIGURE_DEPENDS "*.cpp") ## retrieve all source files in current directory ``` -------------------------------- ### Discovering Source and Header Files in CMake Source: https://github.com/objectcomputing/mfast/blob/master/src/mfast/json/CMakeLists.txt This snippet uses the `file(GLOB)` command to discover all `.h` header files and `.cpp` source files in the current directory. These discovered files are then combined into a single variable `mfast_json_SRCS` for later use in target definitions. `CONFIGURE_DEPENDS` ensures that the glob results are re-evaluated if the file system changes. ```CMake file (GLOB headers CONFIGURE_DEPENDS "*.h") ## retrieve all header files in current directory file (GLOB sources CONFIGURE_DEPENDS "*.cpp") ## retrieve all source files in current directory set(mfast_json_SRCS ${sources} ${headers}) ``` -------------------------------- ### Collecting Source and Header Files in CMake Source: https://github.com/objectcomputing/mfast/blob/master/src/mfast/xml_parser/CMakeLists.txt This snippet uses `file(GLOB_RECURSE)` to collect all header (`.h`) and source (`.cpp`) files within the current directory and its subdirectories. These lists are then stored in `headers` and `sources` variables, which are crucial for defining target sources later in the build process. ```CMake file (GLOB_RECURSE headers CONFIGURE_DEPENDS "*.h") ## retrieve all header files in current directory file (GLOB_RECURSE sources CONFIGURE_DEPENDS "*.cpp") ## retrieve all source files in current directory ``` -------------------------------- ### Compiling the mFAST Test Executable Source: https://github.com/objectcomputing/mfast/blob/master/tests/CMakeLists.txt This command defines the `mfast_test` executable, specifying all the C++ source files and generated FAST type outputs that comprise the test suite. It aggregates various test modules and generated code into a single executable for comprehensive testing of the mFAST library. ```CMake add_executable (mfast_test test_main.cpp arena_allocator_test.cpp field_ref_test.cpp fast_istream_test.cpp fast_ostream_test.cpp decoder_operator_test.cpp encoder_operator_test.cpp encoder_test.cpp encoder_decoder_test.cpp encoder_decoder_test_v2.cpp encoder_decoder_pmap.cpp encoder_decoder_pmap_v2.cpp field_comparator_test.cpp group_encoder_decoder_v2.cpp group_encoder_decoder.cpp coder_test.cpp value_storage_test.cpp ${FASTTYPEGEN_test_types1_OUTPUTS} ${FASTTYPEGEN_test_types3_OUTPUTS} ${FASTTYPEGEN_test_types4_OUTPUTS} ${FASTTYPEGEN_test_types5_OUTPUTS} ${FASTTYPEGEN_test_scp_OUTPUTS} ${FASTTYPEGEN_simple_types1_OUTPUTS} ${FASTTYPEGEN_simple_types2_OUTPUTS} ${FASTTYPEGEN_simple_types3_OUTPUTS} ${FASTTYPEGEN_simple_types4_OUTPUTS} ${FASTTYPEGEN_simple_types5_OUTPUTS} ${FASTTYPEGEN_simple_types6_OUTPUTS} ${FASTTYPEGEN_simple_types7_OUTPUTS} ${FASTTYPEGEN_simple_types8_OUTPUTS} ${FASTTYPEGEN_simple_types9_OUTPUTS} ${FASTTYPEGEN_simple_types10_OUTPUTS} ${FASTTYPEGEN_simple_types11_OUTPUTS} ${FASTTYPEGEN_simple_types12_OUTPUTS} ${FASTTYPEGEN_simple_types13_OUTPUTS} ${FASTTYPEGEN_simple_types14_OUTPUTS} ${FASTTYPEGEN_simple_types15_OUTPUTS} fast_type_gen_test.cpp dictionary_builder_test.cpp json_test.cpp int_vector_test.cpp composite_type_test.cpp aggregate_view_test.cpp simple_coder_test.cpp sequence_encoder_decoder_v2.cpp sequence_encoder_decoder.cpp scp_reset_test.cpp template_repo_base.cpp message_pmap_test.cpp ) ``` -------------------------------- ### Adding Message Printer Subdirectory (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/examples/CMakeLists.txt This command integrates the 'message_printer' directory into the CMake build. It's used to compile and link components related to message printing functionality, likely for logging or output. ```CMake add_subdirectory (message_printer) ``` -------------------------------- ### Including Dependent Subdirectories (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/src/mfast/CMakeLists.txt This snippet includes several subdirectories (`coder`, `xml_parser`, `json`) unconditionally, indicating they are core components of the project. Additionally, it conditionally includes the `sqlite3` subdirectory if the `BUILD_SQLITE3` option is enabled, allowing for optional integration of SQLite3 support. ```CMake add_subdirectory (coder) add_subdirectory (xml_parser) add_subdirectory (json) if (BUILD_SQLITE3) add_subdirectory (sqlite3) endif(BUILD_SQLITE3) ``` -------------------------------- ### Creating a Custom 'dist' Target for Archiving Source: https://github.com/objectcomputing/mfast/blob/master/CMakeLists.txt This section defines a custom CMake target named 'dist' that uses 'git archive' to create a compressed tarball of the project's HEAD. This target facilitates easy distribution of the source code. ```CMake set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${MFAST_VERSION}) add_custom_target(dist COMMAND git archive -o ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2 --prefix=${ARCHIVE_NAME}/ HEAD WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) ``` -------------------------------- ### Including Project Configuration Generation Module Source: https://github.com/objectcomputing/mfast/blob/master/CMakeLists.txt This line includes the GenProjectConfig module, which is typically responsible for generating project-specific configuration files, often placed at the end of the CMakeLists.txt after all targets are defined. ```CMake include(GenProjectConfig) ``` -------------------------------- ### Setting Global CMake Properties and Paths Source: https://github.com/objectcomputing/mfast/blob/master/CMakeLists.txt This snippet configures global CMake properties such as RPATH usage, C++ visibility presets for shared libraries, and whether to build shared or static libraries. It also appends a custom module path for CMake scripts. ```CMake set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) set(CMAKE_CXX_VISIBILITY_PRESET hidden) ## hidden visibility by default is good for everyone set(CMAKE_VISIBILITY_INLINES_HIDDEN ON) set(BUILD_SHARED_LIBS OFF CACHE BOOL "build shared/dynamic library") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") ``` -------------------------------- ### Defining and Linking mFAST Type Generator Executable (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/src/fast_type_gen/CMakeLists.txt This section defines the `fast_type_gen` executable using the previously globbed source and header files. It then links the executable against necessary mFAST static libraries, including `mfast_xml_parser_static`, `mfast_static`, and `mfast_coder_static`, to provide required functionalities. ```CMake add_executable (fast_type_gen) target_sources(fast_type_gen PRIVATE ${headers} ${sources}) target_link_libraries (fast_type_gen PRIVATE mfast_xml_parser_static mfast_static mfast_coder_static) ``` -------------------------------- ### Adding mFAST and fast_type_gen Subdirectories (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/src/CMakeLists.txt This CMake snippet includes the 'mfast' and 'fast_type_gen' projects as subdirectories. This is a common practice in CMake to incorporate external libraries or modules, allowing their build systems to be processed as part of the parent project. It ensures that the necessary targets and dependencies from these subprojects are available for the main build. ```CMake add_subdirectory (mfast) add_subdirectory (fast_type_gen) ``` -------------------------------- ### Commented-Out Model Subdirectory (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/examples/CMakeLists.txt This line shows a commented-out command to add a 'Model' subdirectory. While currently inactive, it indicates a potential future or past component of the project, possibly related to data models or core logic. ```CMake # add_subdirectory (Model) ``` -------------------------------- ### Defining Private Source Files (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/src/mfast/coder/CMakeLists.txt This 'set' command defines a list of private source files (.cpp) that are part of the mFAST Coder library. These files are compiled into the library targets. ```CMake set(sources common/dictionary_builder.cpp decoder/decoder_field_operator.cpp decoder/decoder_presence_map.cpp decoder/fast_decoder.cpp decoder/fast_istream.cpp encoder/encoder_field_operator.cpp encoder/fast_encoder.cpp encoder/fast_ostreambuf.cpp encoder_v2/fast_encoder_core.cpp) ``` -------------------------------- ### Defining tinyxml2 Root Directory in CMake Source: https://github.com/objectcomputing/mfast/blob/master/src/mfast/xml_parser/CMakeLists.txt This command sets the `TINYXML2_ROOT` variable to the absolute path of the tinyxml2 library, relative to the project's source directory. This variable is crucial for locating tinyxml2 source and header files when defining its library target. ```CMake set(TINYXML2_ROOT ${PROJECT_SOURCE_DIR}/tinyxml2/) ``` -------------------------------- ### Collecting Header Files (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/src/mfast/coder/CMakeLists.txt This command collects all header files (.h) recursively from the current directory and its subdirectories. These headers are then used to define the public interface of the library targets. ```CMake file (GLOB_RECURSE headers CONFIGURE_DEPENDS "*.h") ``` -------------------------------- ### Adding Test Dependencies (Commented) Source: https://github.com/objectcomputing/mfast/blob/master/tests/CMakeLists.txt This commented line indicates an intention to add a dependency from `mfast_test` to the `catch` target. While currently inactive, it suggests that `mfast_test` might depend on the `catch` build target for proper compilation or linking in some configurations. ```CMake # add_dependencies(mfast_test catch) ``` -------------------------------- ### Generating Complex FAST Types for Testing Source: https://github.com/objectcomputing/mfast/blob/master/tests/CMakeLists.txt These commands utilize the `FASTTYPEGEN_TARGET` macro to generate C++ code for more complex FAST types, specifically for testing purposes. They process `testX.xml` and `scp.xml` schema definitions, producing C++ outputs essential for various test cases. ```CMake FASTTYPEGEN_TARGET(test_types1 test1.xml test2.xml) FASTTYPEGEN_TARGET(test_types3 test3.xml) FASTTYPEGEN_TARGET(test_types4 test4.xml) FASTTYPEGEN_TARGET(test_types5 test5.xml) FASTTYPEGEN_TARGET(test_scp scp.xml) ``` -------------------------------- ### Importing mFAST Type Generator for Cross-Compilation (CMake) Source: https://github.com/objectcomputing/mfast/blob/master/src/fast_type_gen/CMakeLists.txt This snippet handles the case where CMake is performing a cross-compilation. It imports the `fast_type_gen` executable from a previously built host environment, allowing code generation to proceed even when the target architecture differs from the build host. ```CMake if (CMAKE_CROSSCOMPILING) # import fast_type_gen from the binary tree of a previous host-build, to support generating code when cross-compiling find_package(mFASTTypeGen) ``` -------------------------------- ### Decoding Data with mf_fixed_decode (Shell) Source: https://github.com/objectcomputing/mfast/blob/master/examples/performance_test/ReadMe.txt This command employs the `mf_fixed_decode` tool to decode a data file (`complex30000.dat`). It applies a header fix of 4 bytes, indicating a fixed-format decoding process. This is specifically used for performance evaluation where data has a known, fixed structure. ```Shell mf_fixed_decode -f complex30000.dat -hfix 4 ``` -------------------------------- ### Adding Conditional Test Execution for Emscripten Source: https://github.com/objectcomputing/mfast/blob/master/tests/CMakeLists.txt This conditional block adds a CTest test for `mfast_test`. If the system is Emscripten, it runs the test using `node mfast_test.js`; otherwise, it executes `mfast_test` directly. This ensures cross-platform compatibility for test execution. ```CMake if(${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten") add_test(mfast_test node mfast_test.js) else() add_test(mfast_test mfast_test) endif() ``` -------------------------------- ### Renaming Static Library on UNIX in CMake Source: https://github.com/objectcomputing/mfast/blob/master/src/mfast/xml_parser/CMakeLists.txt This conditional block renames the output file of the `mfast_xml_parser_static` library to `mfast_xml_parser` specifically on UNIX-like systems. This ensures consistent naming conventions for the static library across different operating systems. ```CMake if (UNIX) set_target_properties(mfast_xml_parser_static PROPERTIES OUTPUT_NAME mfast_xml_parser) endif() ``` -------------------------------- ### Adding SIZEOF_VOID_P Compile Definition Source: https://github.com/objectcomputing/mfast/blob/master/CMakeLists.txt This line adds a preprocessor definition SIZEOF_VOID_P to the compile flags, setting its value to the size of a void pointer. This is often used for platform-specific code adjustments. ```CMake add_compile_definitions(SIZEOF_VOID_P=${CMAKE_SIZEOF_VOID_P}) ``` -------------------------------- ### Setting Default Build Type to Debug Source: https://github.com/objectcomputing/mfast/blob/master/CMakeLists.txt This conditional block ensures that if the CMAKE_BUILD_TYPE is not explicitly set, it defaults to 'Debug'. This is useful for development, providing a consistent build configuration. ```CMake if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build" FORCE) endif() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.