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
|
1397
|
17 |
-cpp
|
1371
|
18 |
--make ${hwserv_main}
|
|
19 |
-i${hedgewars_SOURCE_DIR}/netserver
|
1373
|
20 |
-o ${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}
|
|
21 |
-odir ${CMAKE_CURRENT_BINARY_DIR}
|
|
22 |
-hidir ${CMAKE_CURRENT_BINARY_DIR})
|
1370
|
23 |
|
|
24 |
add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}"
|
|
25 |
COMMAND "${ghc_executable}"
|
|
26 |
ARGS ${ghc_flags}
|
1371
|
27 |
MAIN_DEPENDENCY ${hwserv_main}
|
1370
|
28 |
DEPENDS ${hwserver_sources}
|
|
29 |
)
|
|
30 |
|
|
31 |
add_custom_target(hedgewars-server ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}")
|
|
32 |
|
|
33 |
install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION bin)
|