libsuffix with cmake
William A. Hoffman
billlist at nycap.rr.com
Tue Apr 11 22:58:18 CEST 2006
At 04:19 PM 4/11/2006, Andras Mantia wrote:
>On Tuesday 11 April 2006 23:16, William A. Hoffman wrote:
>>
>I couldn't find a way yet to execute some code during configure time and
>reuse the result. Putting the above in an external file and running
>with EXEC_PROGRAM seems to be the only way, but in that case it is not
>known what is the current compiler ($CC is not defined).
Just do a TRY_COMPILE, then an EXEC_PROGRAM (ldd) on the result.
TRY_COMPILE(RESULT_VAR bindir srcdir
projectName <targetname> <CMAKE_FLAGS <Flags>>
<OUTPUT_VARIABLE var>)
If the signature to TRY_COMPILE specifies a source and
binary directory, the directory will not be removed after the build.
For this case you will have to supply the cmakelist.txt file for
the srcdir.
It would be something like this:
try_compile(result
${kdelibs_BINARY_DIR}/CMakeTempDir
${kdelibs_SOURCE_DIR}/test64lib
test64lib)
if(result)
exec_program(ldd ARGS "${kdelibs_BINARY_DIR}/CMakeTempDir/test64bit" OUTPUT_VARIABLE)
endif(result)
in ${kdelibs_SOURCE_DIR}/test64lib/CMakeLists.txt
project(test64lib)
add_executable(test64lib test64lib.c)
OUTPUT_VARIABLE would have the result of ldd in it.
This will not work with HP, and AIX, or Mac as they
do not use ldd.
-Bill
More information about the Kde-buildsystem
mailing list