]> Creatis software - gdcm.git/blob - Builder/CMakeLists.txt
BUG: Replace 0 with SEEK_SET, this was wrong for djgpp
[gdcm.git] / Builder / CMakeLists.txt
1 IF(NOT GDCM_WRAP_PYTHON)
2   MESSAGE(ERROR "INNOSETUP_EXECUTABLE require GDCM_WRAP_PYTHON set to YES")
3 ENDIF(NOT GDCM_WRAP_PYTHON)
4 IF(NOT GDCM_VTK)
5   MESSAGE(ERROR "INNOSETUP_EXECUTABLE require GDCM_VTK set to YES")
6 ENDIF(NOT GDCM_VTK)
7 IF(NOT BUILD_EXAMPLES)
8   MESSAGE(ERROR "INNOSETUP_EXECUTABLE require BUILD_EXAMPLES set to YES")
9 ENDIF(NOT BUILD_EXAMPLES)
10
11 IF(WIN32)
12   # Search InnoSetup:
13   FIND_FILE(INNOSETUP_EXECUTABLE ISCC.exe
14     "C:/Program Files/Inno Setup 5"
15     DOC "InnoSetup executable"
16   )
17
18   IF(EXISTS INNOSETUP_EXECUTABLE)
19     MESSAGE(ERROR "INNOSETUP_EXECUTABLE isn't set properly")
20   ENDIF(EXISTS INNOSETUP_EXECUTABLE)
21
22   #-----------------------------------------------------------------------------
23   # Set new variables to have Windows Paths
24   STRING(REGEX REPLACE "/" "\\\\" INNO_SOURCE_DIR ${GDCM_SOURCE_DIR})
25   STRING(REGEX REPLACE "/" "\\\\" INNO_BINARY_DIR ${GDCM_BINARY_DIR})
26   STRING(REGEX REPLACE "/" "\\\\" INNO_DATA_DIR   ${GDCM_DATA_ROOT})
27
28   #-----------------------------------------------------------------------------
29   # Build the installer
30   CONFIGURE_FILE(
31       ${GDCM_SOURCE_DIR}/Builder/gdcm.iss.in
32       ${GDCM_BINARY_DIR}/Builder/gdcm.iss
33   )
34
35   ADD_CUSTOM_TARGET(InstallerWin32
36     ALL
37     ${INNOSETUP_EXECUTABLE} ${GDCM_BINARY_DIR}/Builder/gdcm.iss
38   )
39   #-----------------------------------------------------------------------------
40 ENDIF(WIN32)
41
42 IF(UNIX)
43   #-----------------------------------------------------------------------------
44   # Build the installer
45   CONFIGURE_FILE(
46       ${GDCM_SOURCE_DIR}/Builder/gdcm.spec.in
47       ${GDCM_BINARY_DIR}/Builder/gdcm.spec
48   )
49
50   STRING(REGEX REPLACE ".*/" "" SPEC_SOURCE_DIR ${GDCM_SOURCE_DIR})
51   EXEC_PROGRAM("date +%Y%m%d" OUTPUT_VARIABLE GDCM_DATE)
52
53   EXEC_PROGRAM("tar -zcvf ${GDCM_BINARY_DIR}/Builder/gdcm.tar.gz ${SPEC_SOURCE_DIR}" ${GDCM_SOURCE_DIR}/..)
54   #-----------------------------------------------------------------------------
55 ENDIF(UNIX)