[CMake] TRY_RUN wrong program return value with --debug-compile
Eduardo Alberto Hernández Muñoz
coz.eduardo.hernandez at gmail.com
Tue Jun 3 00:02:23 EDT 2008
Hi list,
I'm having a new problem with CMake; if anyone cares/remembers the
past one, it was just a stupid typo in the filename.
I have the file check_openal_spec_version_1_1.cpp which contains:
#define AL_VERSION_1_1
#define AL_VERSION_1_0
int main() {
#ifdef AL_VERSION_1_1
return 2;
#elif AL_VERSION_1_0
return 1;
#else
return -1;
#endif
}
and I have this command in the file FindOpenAL.cmake:
TRY_RUN (
OPENAL_VERSION
OPENAL_COMPILED
${CMAKE_BINARY_DIR}
${BUILD_DIR}check_openal_spec_version_1_1.cpp
COMPILE_DEFINITIONS "-I${OPENAL_INCLUDE_DIR}"
)
The problem is that OPENAL_VERSION 80% of the time is 0, but sometimes
is 1, and sometimes 2, never anything else. The correct value returned
should be always 2. OPENAL_COMPILED is always TRUE.
I have another module which uses returns as a mean to get the version
using #defines, and when the OpenAL check goes on ( OPENAL_VERSION is
either 1 or 2 ), the second module has the same issue, returning 0 in
the TRY_RUN().
The interesting part, is that this problem only happens when I pass
the --debug-trycompile to cmake. Without the flag, CMake works
wonderfully.
-Coz
More information about the CMake
mailing list