Hello,

Is it possible to wrap an existing macro that returns a result via one of its 
arguments? I think it will be clear what I would like to do from the following 
example:

if(${INTRINSICS_TEST_TYPE} MATCHES "compiles")
    macro(check_intrinsics_availability source var)
        check_c_source_compiles(source var)
    endmacro()
elseif(${INTRINSICS_TEST_TYPE} MATCHES "runs")
    include(CheckCSourceRuns)
    macro(check_intrinsics_availability source var)
        check_c_source_runs(source var)
    endmacro()
elseif(${INTRINSICS_TEST_TYPE} MATCHES "none")
    macro(check_intrinsics_availability source var)
        set(${var} 1)
        set(${var}_EXITCODE 0)
    endmacro()
else()
    macro(check_intrinsics_availability source var)
        set(${var} 0)
        set(${var}_EXITCODE 1)
    endmacro()
endif()


This does not have the intended effect: when INTRINSICS_TEST_TYPE == 
"compiles", 
cmake prints "Performing test var - Failed". Evidently I'd like it to perform 
test ${var}, in other words, the check_intrinsics_availability macro should 
behave exactly as either check_c_source_compiles or check_c_source_runs.

Additionally, the "none" and fallback cases are supposed to behave if 
check_c_source_?? succeeded or failed, respectively. Are they implemented 
correctly?

Thanks,
R.

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to