summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt17
-rw-r--r--XCompile.txt24
2 files changed, 27 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4956329e..7dbe2f93 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,10 +34,8 @@ OPTION(WERROR "Treat compile warnings as errors" OFF)
OPTION(EXAMPLES "Build example programs" ON)
-OPTION(XCOMPILEWIN32 "Cross-compile to Win32" OFF)
-
-IF(WIN32 OR XCOMPILEWIN32)
+IF(WIN32)
SET(LIBNAME openal32)
ADD_DEFINITIONS("-D_WIN32")
ELSE()
@@ -104,7 +102,7 @@ ELSE()
FORCE)
# Set visibility options if available
- IF(NOT WIN32 AND NOT XCOMPILEWIN32)
+ IF(NOT WIN32)
CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor));
int main() {return 0;}" HAVE_GCC_DESTRUCTOR)
@@ -374,15 +372,6 @@ SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES VERSION ${LIB_VERSION}
IF(WIN32)
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES PREFIX "")
ENDIF()
-IF(XCOMPILEWIN32)
- SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES PREFIX "" SUFFIX .dll)
- IF(EXAMPLES)
- SET(EXAMPLES OFF)
- MESSAGE(STATUS "")
- MESSAGE(STATUS "Building examples disabled when cross-compiling")
- ENDIF()
-ENDIF()
-SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES OUTPUT_NAME ${LIBNAME})
TARGET_LINK_LIBRARIES(${LIBNAME} ${EXTRA_LIBS})
@@ -415,7 +404,7 @@ MESSAGE(STATUS "Building OpenAL with support for the following backends:")
MESSAGE(STATUS " ${BACKENDS}")
MESSAGE(STATUS "")
-IF(WIN32 OR XCOMPILEWIN32)
+IF(WIN32)
IF(NOT HAVE_DSOUND)
MESSAGE(STATUS "WARNING: Building the Windows version without DirectSound output")
MESSAGE(STATUS " This is probably NOT what you want!")
diff --git a/XCompile.txt b/XCompile.txt
new file mode 100644
index 00000000..391fae6c
--- /dev/null
+++ b/XCompile.txt
@@ -0,0 +1,24 @@
+# Cross-compiling requires CMake 2.6 or newer. To cross-compile, first modify
+# this file to set the proper settings and paths. Then use it from CMakeConf/
+# like:
+# cmake .. -DCMAKE_TOOLCHAIN_FILE=../XCompile.txt \
+# -DCMAKE_INSTALL_PREFIX=/usr/mingw32/mingw
+# If you already have a toolchain file setup, you may use that instead of this
+# file.
+
+# the name of the target operating system
+SET(CMAKE_SYSTEM_NAME Windows)
+
+# which compilers to use for C and C++
+SET(CMAKE_C_COMPILER /usr/bin/mingw32-gcc)
+SET(CMAKE_CXX_COMPILER /usr/bin/mingw32-g++)
+
+# here is the target environment located
+SET(CMAKE_FIND_ROOT_PATH /usr/mingw32/mingw)
+
+# adjust the default behaviour of the FIND_XXX() commands:
+# search headers and libraries in the target environment, search
+# programs in the host environment
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)