netserver/CMakeLists.txt
author unc0rr
Sun, 15 Mar 2009 14:36:14 +0000
changeset 1893 85c61bc5e160
parent 1497 b4586b0f4426
permissions -rw-r--r--
Style fixes by nemo
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
e206cdb009a7 Fix compilation
unc0rr
parents: 1370
diff changeset
    17
	--make ${hwserv_main}
e206cdb009a7 Fix compilation
unc0rr
parents: 1370
diff changeset
    18
	-i${hedgewars_SOURCE_DIR}/netserver
1373
ca719502b87f Fix out-of-source build
unc0rr
parents: 1372
diff changeset
    19
	-o ${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}
ca719502b87f Fix out-of-source build
unc0rr
parents: 1372
diff changeset
    20
	-odir ${CMAKE_CURRENT_BINARY_DIR}
ca719502b87f Fix out-of-source build
unc0rr
parents: 1372
diff changeset
    21
	-hidir ${CMAKE_CURRENT_BINARY_DIR})
1370
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
    22
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
    23
add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}"
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
    24
		COMMAND "${ghc_executable}"
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
    25
		ARGS ${ghc_flags}
1371
e206cdb009a7 Fix compilation
unc0rr
parents: 1370
diff changeset
    26
		MAIN_DEPENDENCY ${hwserv_main}
1370
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
    27
		DEPENDS ${hwserver_sources}
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
    28
		)
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
    29
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
    30
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
    31
ff8863ebde17 Add hedgewars server to build process
unc0rr
parents:
diff changeset
    32
install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION bin)