Does Cinder save Cmake platform definitions to be used in blocks?

Hi, I’m making a Cinder block on top of libnfc for NFC applications. I want to make it cross-platform using libcinder’s Cmake ecosystem. The block needs to link to the static libnfc.a file which is located on a path dependent to the platform and architecture of Cinder. For instance right now I do this in my Cinder-libnfcConfig.cmake file to link to the lib:

target_link_libraries( Cinder-libnfc PUBLIC "${LIBNFC_PATH}/lib/libnfc/lib/linux/x86_64/libnfc.a" )

I’d like to make this in a way that Cmake automagically detects the right path based on the platform configurations. To get the platform, right now I use if() checks for CINDER_LINUX, CINDER_MSW and so on. I thought maybe Cinder saves this in a string when it’s built and instead of doing the checks again I can just use that string. Is there such thing? How about the architecture configs?

Hey,

Cinder’s configure.cmake sets all necessary variables that you would need to achieve what you want and should all be available already inside your Cinder-libnfcConfig.cmake after the following check:

    .....

    if( NOT TARGET cinder )
            include( "${CINDER_PATH}/proj/cmake/configure.cmake" )
            find_package( cinder REQUIRED PATHS
                "${CINDER_PATH}/${CINDER_LIB_DIRECTORY}"
                "$ENV{CINDER_PATH}/${CINDER_LIB_DIRECTORY}" )
    endif()
    # Variables set inside configure.cmake should be in scope from here on

    .....

HTH,
Petros

Hey Petros,
Thanks for taking a look into this!

Indeed it was all available after that check as you noted. CINDER_TARGET_LOWER and CINDER_ARCH came to the rescue. So now, thanks to your tip, without any extra checks I just write this:

target_link_libraries( Cinder-libnfc PUBLIC "${LIBNFC_PATH}/lib/libnfc/lib/${CINDER_TARGET_LOWER}/${CINDER_ARCH}/libnfc.a" )