summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-04-01 11:40:00 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-04-01 13:36:20 -0700
commit70527ac83a04c95f62791d1adf74acd8cb42e65a (patch)
treed69b17c4c7cb55dfdf4e8486351af1d764a18e83 /CMakeLists.txt
parent1b0d0687f83aa74a6b9962ac3bb3e407cc07f6b8 (diff)
downloadsubsurface-70527ac83a04c95f62791d1adf74acd8cb42e65a.tar.gz
cmake: setup .nsi file when cross building for Windows
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt12
1 files changed, 12 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e5960ddb4..0814bdbbf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -108,6 +108,9 @@ FILE(WRITE ${CMAKE_BINARY_DIR}/version.cmake "
ELSE ()
SET(VER_OS linux)
ENDIF ()
+ IF(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")
+ SET(VER_OS win)
+ ENDIF ()
EXECUTE_PROCESS(
COMMAND sh scripts/get-version \${VER_OS}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
@@ -127,10 +130,19 @@ FILE(WRITE ${CMAKE_BINARY_DIR}/version.cmake "
OUTPUT_STRIP_TRAILING_WHITESPACE
)
CONFIGURE_FILE(\${SRC} \${DST} @ONLY)
+ IF(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")
+ EXECUTE_PROCESS(
+ COMMAND cat ${CMAKE_SOURCE_DIR}/packaging/windows/subsurface.nsi.in
+ COMMAND sed -e \"s/VERSIONTOKEN/\${VERSION_STRING}/\"
+ COMMAND sed -e \"s/PRODVTOKEN/\${CANONICAL_VERSION_STRING}/\"
+ OUTPUT_FILE ${CMAKE_BINARY_DIR}/staging/subsurface.nsi
+ )
+ ENDIF()
")
ADD_CUSTOM_TARGET(version ALL COMMAND
${CMAKE_COMMAND} -D SRC=${CMAKE_BINARY_DIR}/version.h.in
-D DST=${CMAKE_BINARY_DIR}/ssrf-version.h
+ -D CMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
-P ${CMAKE_BINARY_DIR}/version.cmake
)