[CMake] TRY_COMPILE and multiple libs

Brian Macy bmacy at macykids.net
Fri Dec 8 18:17:16 EST 2006


I am trying to compile to verify that cppunit is available and 
compatible with my compiler and settings before enabling it.  I'm 
attempting to use try compile but am failing when the OS needs other 
libraries (like libdl).

I tried this and a few alternative methods but it is failing:

SET (TESTLIBS ${LINKLIBS} ${CPPUNIT_LIBRARY})
SET (TESTDIRS ${LINK_DIRECTORIES})

TRY_COMPILE(ENABLE_CPPUNIT_TESTS
        ${CMAKE_BINARY_DIR}
        ${CMAKE_BINARY_DIR}/CMakeTmp/testCppUnit.cpp
        CMAKE_FLAGS -DINCLUDE_DIRECTORIES:string="${CPPUNIT_INCLUDE_DIR}"
                -DLINK_LIBRARIES:string="${TESTLIBS}"
                -DLINK_DIRECTORIES:string=${TESTDIRS}
        OUTPUT_VARIABLE CPPUNIT_OUTPUT
        )


Brian Macy




More information about the CMake mailing list