[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] CMakeLists.txt CYGWIN vs. CMAKE_COMPILER_IS_GNUCC
From: |
Brandon J. Van Every |
Subject: |
[Chicken-users] CMakeLists.txt CYGWIN vs. CMAKE_COMPILER_IS_GNUCC |
Date: |
Sun, 11 Dec 2005 16:37:32 -0800 |
User-agent: |
Mozilla Thunderbird 1.0.2 (Windows/20050317) |
Sometimes a test is given like
IF(WIN32 AND NOT CYGWIN)
when really what is warranted is
IF(WIN32 AND NOT CMAKE_COMPILER_IS_GNUCC)
MinGW is of course a GCC variant. It has some of the same capabilities
as Cygwin, and lacks others. The Cygwin stuff is specific to
cygwin-1.dll, not to the compiler itself. For instance, the MinGW
compiler seems to handle library names in Unix-y fashion, prepending
lib* to the output. So the following is desired:
# since libchicken has to be the name of the dll or .so to load
# On unix lib is the default prefix added to any library.
# For windows we change the name of the library to be libchicken.
IF(WIN32 AND NOT CMAKE_COMPILER_IS_GNUCC)
SET(CHICKEN_LIB_NAME libchicken)
SET(CHICKEN_UNSAFE_LIB_NAME libuchicken)
ELSE(WIN32 AND NOT CMAKE_COMPILER_IS_GNUCC)
SET(CHICKEN_LIB_NAME chicken)
SET(CHICKEN_UNSAFE_LIB_NAME uchicken)
ENDIF(WIN32 AND NOT CMAKE_COMPILER_IS_GNUCC)
Or at least, this fixes a problem in library output names. Without it,
CMake generates liblibchicken.dll, and later stuff fails because
libchicken.dll can't be found. I'm not entirely sure if this is due to
MinGW's behavior, or if CMake is generating stuff erroneously, but the
above seems reasonable. Similarly, I will hazard a guess that we really
want:
IF(WIN32 AND NOT CMAKE_COMPILER_IS_GNUCC)
ADD_DEFINITIONS(-DC_DEFAULT_TARGET_STACK_SIZE=300000)
ADD_DEFINITIONS(-DHAVE_LOADLIBRARY)
ADD_DEFINITIONS(-DHAVE_GETPROCADDRESS)
ENDIF(WIN32 AND NOT CMAKE_COMPILER_IS_GNUCC)
but I am not actually sure of this. Is this a VC++ specific issue, or a
non-GCC issue? If it's VC++ specific, then VC++ should be explicitly
tested for. I'm not sure what the best test variable is for this. The
CMake documentation is decidedly mediocre as far as documenting the test
variables. There's a list of stuff on the CMake wiki, kinda buried amid
other things, and doesn't seem to be complete either.
Also, the above changes aren't fullly working solutions yet. They're
only a piece of the problem: fixing the MinGW behavior is creating a
make target name collision for chicken.exe and libchicken.dll. They
both get a make target of "chicken." I've got some stuff to straighten
out; meanwhile, be aware that CYGWIN isn't the only GCC on Windows.
Cheers,
Brandon Van Every
RTFM ISA PITA
- [Chicken-users] CMakeLists.txt CYGWIN vs. CMAKE_COMPILER_IS_GNUCC,
Brandon J. Van Every <=