[CMake] Hi and some newbie questions
Hendrik Sattler
post at hendrik-sattler.de
Fri Sep 14 19:20:46 EDT 2007
Am Freitag 14 September 2007 schrieb Goswin von Brederlow:
> "wim van hoydonck" <wim.van.hoydonck at gmail.com> writes:
> > On a Unix-like OS, you can execute "uname -m" to get the machine
> > architecture (but this is probably not really portable to M$...):
>
> Not even portable across systems of the same architecture nor
> accurate. On IA32 (x86) you want to compile for i486 but uname will
> say anything from i486 to i686 and even x86_64 given a 64bit kernel.
>
> On the other hand using "dpkg-architecture" is way to debian specific.
>
> Something inbetween is to ask the gcc. But then you are gcc
> specific (Good enough for me).
But isn't that exactly what you want? You want to know what you current
compiler compiles for, not what architecture you are currently using. When I
run a i586 kernel but gcc produces code for i486, then i486 is wanted.
Same for CPack file naming: the current binary package naming scheme doesn't
make much sense because you need more than "Linux" to define what the
included binary is for. "gcc -dumpmachine" would be much better, be
it "i486-linux-gnu", "i586-linux-uclibc" or whatever. If CMake (and CPack)
ever get to a better target system description, I can finally rip out lots of
lines from CMakeLists.txt files.
Currently, those are:
execute_process (
COMMAND ${CMAKE_C_COMPILER} -dumpmachine
OUTPUT_VARIABLE CPACK_SYSTEM_NAME
)
string ( REGEX REPLACE "[\r\n]" "" CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME} )
set ( CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${CPACK_PACKAGE_VERSION}" )
if ( CPACK_SYSTEM_NAME )
set ( CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_FILE_NAME}_${CPACK_SYSTEM_NAME}" )
endif ( CPACK_SYSTEM_NAME )
set (
CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${CPACK_PACKAGE_VERSION}-source" )
For C++-Libraries, even the compiler and its ABI version may have to be added.
HS
More information about the CMake
mailing list