[CMake] Differentiating between FreeBSD and Linuxs
Hendrik Sattler
post at hendrik-sattler.de
Wed May 16 20:45:04 EDT 2007
Am Mittwoch 16 Mai 2007 18:52 schrieb Ajay Divekar:
> I was trying to differentiate between FreeBSD and Linux's and found that by
> using CMAKE_SYSTEM_NAME variable I will be able to do that. I had
>
> if (CMAKE_SYSTEM_NAME MATCHES Linux)
> SET(...)
> ELSE(CMAKE_SYSTEM_NAME MATCHES Linux)
> SET(...)
> ENDIF(CMAKE_SYSTEM_NAME MATCHES Linux)
Sadly, this variable is also use by CPack to name the resulting file. This has
several disadvantages:
- very uncommon naming (not all lowercase)
- not descriptive enough because the architecture is missing
- it describes the build system and not what the binary was built for
Can CPack be changed to default to "gcc -dumpmachine" on Unix systems when
using gcc (with replacing the first part of the triplet when -march is used)?
The same is for Windows: it matters if a C++ library was build with mingw32 or
with the microsoft compiler and the automatic package naming should take
notice of this (e.g. "mingw32"/"mingw64" for g++, "win32"/"win64" for vc++).
Sure, it can be done manually in the CMakeLists.txt but it is a pain to do for
every project :-/
HS
More information about the CMake
mailing list