summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-03-26 12:24:46 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-03-26 12:25:26 -0700
commitc41b1dc6888fea68d38a61be0a5b8058a369f52b (patch)
treeadfd2168f10ee88ff07369b3960698bb33d00622 /CMakeLists.txt
parent0a4444930e92a657c41b8dca59b728169f607ced (diff)
downloadsubsurface-c41b1dc6888fea68d38a61be0a5b8058a369f52b.tar.gz
cmake: add support to compile for Windows and Mac
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt15
1 files changed, 14 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 51573cd75..639945d2d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -119,6 +119,19 @@ ADD_CUSTOM_TARGET(version ALL COMMAND
-P ${CMAKE_BINARY_DIR}/version.cmake
)
+SET(PLATFORM_SRC unknown_platform.c)
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ SET(PLATFORM_SRC linux.c)
+ENDIF()
+IF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ SET(PLATFORM_SRC macos.c)
+ENDIF()
+IF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+ SET(PLATFORM_SRC windows.c)
+ set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lwsock32)
+ remove_definitions(-DUNICODE)
+ENDIF()
+
# compile the core library, in C.
SET(SUBSURFACE_CORE_LIB_SRCS
cochran.c
@@ -151,7 +164,6 @@ SET(SUBSURFACE_CORE_LIB_SRCS
uemis.c
uemis-downloader.c
version.c
- linux.c
#gettextfrommoc should be added because we are using it on the c-code.
gettextfromc.cpp
#dirk ported some core functionality to c++.
@@ -163,6 +175,7 @@ SET(SUBSURFACE_CORE_LIB_SRCS
configuredivecomputer.cpp
configuredivecomputerthreads.cpp
divesitehelpers.cpp
+ ${PLATFORM_SRC}
)
#the interface, in C++