How cmake is used to build ceda based projects

#############################################################

Finding package Ceda

find_package(Ceda CONFIG REQUIRED) should be used to find the Ceda package. or just find_package(Ceda REQUIRED) # Searches for a package with the name Ceda # The command searches for a file called CedaConfig.cmake # Search procedure: # Under each prefix several directories are searched for a configuration file under including # /lib/cmake/Ceda/ # # C:\Program Files\Ceda\android-arm64-v8a\lib\cmake\Ceda\CedaConfig.cmake

#############################################################

Showing the considered configs and versions

After calling find_package(Ceda CONFIG REQUIRED), use the following:

    message(Ceda_CONSIDERED_CONFIGS = ${Ceda_CONSIDERED_CONFIGS})
    message(Ceda_CONSIDERED_VERSIONS = ${Ceda_CONSIDERED_VERSIONS})

to show the considered configurations and versions of CEDA

#############################################################

Debugging some CMake variables

# CMAKE_LIBRARY_ARCHITECTURE=aarch64-linux-android
# CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=
# CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=
# CMAKE_FIND_PACKAGE_SORT_ORDER=
# CMAKE_FIND_PACKAGE_SORT_DIRECTION=
# CMAKE_PREFIX_PATH=
# CMAKE_SYSTEM_PREFIX_PATH=/usr/local/usr/C:/Program Files/CMakeC:/cedanet/repos/ceda-samples/../../build-ceda-samples/android-arm64-v8a-RelWithDebInfo-shared/install/usr/X11R6/usr/pkg/opt
# CMAKE_FIND_ROOT_PATH=C:/Users/DavidBarrett-Lennard/AppData/Local/Android/Sdk/ndk-bundle
# CMAKE_STAGING_PREFIX=
# CMAKE_SYSROOT=C:/Users/DavidBarrett-Lennard/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/sysroot
# CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS=

message(CMAKE_LIBRARY_ARCHITECTURE = ${CMAKE_LIBRARY_ARCHITECTURE})
message(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY = ${CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY})
message(CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY = ${CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY})
message(CMAKE_FIND_PACKAGE_SORT_ORDER = ${CMAKE_FIND_PACKAGE_SORT_ORDER})
message(CMAKE_FIND_PACKAGE_SORT_DIRECTION = ${CMAKE_FIND_PACKAGE_SORT_DIRECTION})
message(CMAKE_PREFIX_PATH = ${CMAKE_PREFIX_PATH})
message(CMAKE_SYSTEM_PREFIX_PATH = ${CMAKE_SYSTEM_PREFIX_PATH})
message(CMAKE_FIND_ROOT_PATH = ${CMAKE_FIND_ROOT_PATH})
message(CMAKE_STAGING_PREFIX = ${CMAKE_STAGING_PREFIX})
message(CMAKE_SYSROOT = ${CMAKE_SYSROOT})
message(CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS = ${CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS})
message(BUILD_SHARED_LIBS = ${BUILD_SHARED_LIBS})

showCommonVars()
showCedaVars()
#############################################################

Finding the boost libraries

cedaFindBoost()
#############################################################

cedaSetSourceRoot

cedaSetSourceRoot("${CMAKE_CURRENT_SOURCE_DIR}/..")
#############################################################

Use of global properties

# Various values are saved in global properties: # # GP_CEDA_XCPP Path to Xcpp # GP_CEDA_XCPPCONFIG # GP_CEDA_CONFIG "Debug", "Release" or "RelWithDebInfo" # GP_CEDA_PLATFORM Windows-x86 / Windows-x64 / Android-aarch64 # # This is necessary because a subdirectory cmake scope may include CedaCommon.cmake and yet the 'last step' call-back # to cedaRunXcppOnWorkspace may occur in a parent scope where the cmake variables set from CedaCommon.cmake may not be # visible.

GP_CEDA_PLATFORM

Possible values are: Windows-x86 Windows-x64 Android-aarch64

    if("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
        if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64")
            if (${CMAKE_SIZEOF_VOID_P} EQUAL "8")
                set(cedaPlatform "Windows-x64")
            else()
                # If CMAKE_SIZEOF_VOID_P disagrees with CMAKE_SYSTEM_PROCESSOR then go by CMAKE_SIZEOF_VOID_P
                set(cedaPlatform "Windows-x86")
            endif()
        elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86")
            set(cedaPlatform "Windows-x86")
        else()
            set(cedaPlatform ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
        endif()
    else()
        set(cedaPlatform ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
    endif()
#############################################################

Reason for running cedaRunXcppOnWorkspace() at the end of the configure phase

The CMake build process runs in three phases : configure, build, install. During the configure phase, cmake is executing statements in the CMakeLists.txt files. There may be any number of calls to the CMake macro cedaSetSourceRoot and CMake function cedaTarget, while processing nested scopes, and in which CedaCommon.cmake may be included multiple times. Each call to the macro cedaSetSourceRoot ensures the following global property variables are set correctly: GP_CEDA_XCPP GP_CEDA_XCPPCONFIG GP_CEDA_CONFIG GP_CEDA_PLATFORM Also CMake variables are set (this is why cedaSetSourceRoot is a macro): CEDA_XCPP_ROOT CEDA_SOURCE_ROOT todo: why is include_directories called??? cedaAddSourceRoot