- Added more features for cross-compilation.

This commit is contained in:
ccremers 2007-01-08 07:38:17 +00:00
parent 3f68f5ece5
commit 0a1a13dd5a

View File

@ -30,38 +30,55 @@ include (SVNVersion.cmake)
include (ScannerParser.cmake) include (ScannerParser.cmake)
# By default, we build what we get # By default, we build what we get
if (WIN32) mark_as_advanced (CLEAR TARGETOS)
set (TARGETOS "WIN32") if (NOT TARGETOS)
else (WIN32) if (WIN32)
if (APPLE) set (TARGETOS "WIN32")
set (TARGETOS "APPLE") else (WIN32)
else (APPLE) if (APPLE)
if (UNIX) set (TARGETOS "APPLE")
set (TARGETOS "UNIX") else (APPLE)
endif (UNIX) if (UNIX)
endif (APPLE) set (TARGETOS "UNIX")
endif (WIN32) endif (UNIX)
endif (APPLE)
endif (WIN32)
endif (NOT TARGETOS)
# Determine name from type # Determine name and target from type
if (${TARGETOS} STREQUAL "UNIX") if (${TARGETOS} STREQUAL "UNIX")
message (STATUS "Building Linux version") # Should for now only be done on the unix platform
set (scythername "scyther-linux") if (UNIX)
message (STATUS "Building Linux version")
set (scythername "scyther-linux")
add_executable (${scythername} ${Scyther_sources})
endif (UNIX)
endif (${TARGETOS} STREQUAL "UNIX") endif (${TARGETOS} STREQUAL "UNIX")
if (${TARGETOS} STREQUAL "APPLE") if (${TARGETOS} STREQUAL "APPLE")
message (STATUS "Building Apple version") if (APPLE)
set (scythername "scyther-mac") # Should for now only be done on the apple platform
message (STATUS "Building Apple version")
set (scythername "scyther-mac")
add_executable (${scythername} ${Scyther_sources})
endif (APPLE)
endif (${TARGETOS} STREQUAL "APPLE") endif (${TARGETOS} STREQUAL "APPLE")
if (${TARGETOS} STREQUAL "WIN32") if (${TARGETOS} STREQUAL "WIN32")
# This should work on win32 platform, but also when the compiler
# is available anyway under linux
set (CMAKE_C_COMPILER "i586-mingw32msvc-gcc")
set (CMAKE_CXX_COMPILER "i586-mingw32msvc-g++")
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS) # to get rid of -rdynamic
message (STATUS "Building W32 version") message (STATUS "Building W32 version")
set (scythername "scyther-w32") set (scythername "scyther-w32.exe")
add_executable (${scythername} ${Scyther_sources})
endif (${TARGETOS} STREQUAL "WIN32") endif (${TARGETOS} STREQUAL "WIN32")
# Make the Scyther linux binary # Make the Scyther linux binary
if (scythername) if (NOT scythername)
add_executable (${scythername} ${Scyther_sources})
else (scythername)
message (FATAL_ERROR "Cannot determine target platform [${TARGETOS}]") message (FATAL_ERROR "Cannot determine target platform [${TARGETOS}]")
endif (scythername) endif (NOT scythername)