1370
|
1 |
find_program(ghc_executable ghc)
|
|
2 |
|
|
3 |
if (NOT ghc_executable)
|
1372
|
4 |
message(FATAL_ERROR "Cannot find GHC")
|
1370
|
5 |
endif(NOT ghc_executable)
|
|
6 |
|
|
7 |
set(hwserver_sources
|
|
8 |
HWProto.hs
|
|
9 |
Miscutils.hs
|
|
10 |
Opts.hs
|
|
11 |
hedgewars-server.hs
|
|
12 |
)
|
|
13 |
|
1371
|
14 |
set(hwserv_main ${hedgewars_SOURCE_DIR}/netserver/hedgewars-server.hs)
|
|
15 |
|
|
16 |
set(ghc_flags
|
|
17 |
--make ${hwserv_main}
|
|
18 |
-i${hedgewars_SOURCE_DIR}/netserver
|
1373
|
19 |
-o ${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}
|
|
20 |
-odir ${CMAKE_CURRENT_BINARY_DIR}
|
|
21 |
-hidir ${CMAKE_CURRENT_BINARY_DIR})
|
1370
|
22 |
|
|
23 |
add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}"
|
|
24 |
COMMAND "${ghc_executable}"
|
|
25 |
ARGS ${ghc_flags}
|
1371
|
26 |
MAIN_DEPENDENCY ${hwserv_main}
|
1370
|
27 |
DEPENDS ${hwserver_sources}
|
|
28 |
)
|
|
29 |
|
|
30 |
add_custom_target(hedgewars-server ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}")
|
|
31 |
|
|
32 |
install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION bin)
|