netserver/CMakeLists.txt
author unc0rr
Fri, 31 Oct 2008 17:58:18 +0000
changeset 1453 2dc2c4429756
parent 1397 471c42a1c358
child 1497 b4586b0f4426
permissions -rw-r--r--
Add theme icons to the list of packaged files
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1370
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
     1
find_program(ghc_executable ghc)
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
     2
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
     3
if (NOT ghc_executable)
1372
69ceb24d40d0 Fix error message
unc0rr
parents: 1371
diff changeset
     4
	message(FATAL_ERROR "Cannot find GHC")
1370
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
     5
endif(NOT ghc_executable)
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
     6
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
     7
set(hwserver_sources
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
     8
	HWProto.hs
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
     9
	Miscutils.hs
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
    10
	Opts.hs
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
    11
	hedgewars-server.hs
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
    12
	)
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
    13
1371
e206cdb009a7 Fix compilation
unc0rr
parents: 1370
diff changeset
    14
set(hwserv_main ${hedgewars_SOURCE_DIR}/netserver/hedgewars-server.hs)
e206cdb009a7 Fix compilation
unc0rr
parents: 1370
diff changeset
    15
e206cdb009a7 Fix compilation
unc0rr
parents: 1370
diff changeset
    16
set(ghc_flags
1397
471c42a1c358 Use C preprocessor to allow compilation in windows
unc0rr
parents: 1373
diff changeset
    17
	-cpp
1371
e206cdb009a7 Fix compilation
unc0rr
parents: 1370
diff changeset
    18
	--make ${hwserv_main}
e206cdb009a7 Fix compilation
unc0rr
parents: 1370
diff changeset
    19
	-i${hedgewars_SOURCE_DIR}/netserver
1373
ca719502b87f Fix out-of-source build
unc0rr
parents: 1372
diff changeset
    20
	-o ${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}
ca719502b87f Fix out-of-source build
unc0rr
parents: 1372
diff changeset
    21
	-odir ${CMAKE_CURRENT_BINARY_DIR}
ca719502b87f Fix out-of-source build
unc0rr
parents: 1372
diff changeset
    22
	-hidir ${CMAKE_CURRENT_BINARY_DIR})
1370
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
    23
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
    24
add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}"
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
    25
		COMMAND "${ghc_executable}"
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
    26
		ARGS ${ghc_flags}
1371
e206cdb009a7 Fix compilation
unc0rr
parents: 1370
diff changeset
    27
		MAIN_DEPENDENCY ${hwserv_main}
1370
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
    28
		DEPENDS ${hwserver_sources}
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
    29
		)
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
    30
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
    31
add_custom_target(hedgewars-server ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}")
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
    32
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
    33
install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION bin)