1# Generate .plt file, if it doesn't exist
2GET_FILENAME_COMPONENT (_couchdb_bin_dir "${COUCHDB_BIN_DIR}" REALPATH)
3
4IF (NOT EXISTS "${COUCHBASE_PLT}")
5  MESSAGE ("Generating ${COUCHBASE_PLT}...")
6  EXECUTE_PROCESS (COMMAND "${CMAKE_COMMAND}" -E echo
7    dialyzer --output_plt "${COUCHBASE_PLT}" --build_plt
8    --apps compiler crypto erts inets kernel os_mon sasl ssl stdlib xmerl
9    ${_couchdb_bin_dir}/src/mochiweb
10    ${_couchdb_bin_dir}/src/snappy ${_couchdb_bin_dir}/src/etap
11    ${_couchdb_bin_dir}/src/lhttpc
12    ${_couchdb_bin_dir}/src/erlang-oauth deps/gen_smtp/ebin)
13
14  EXECUTE_PROCESS (COMMAND dialyzer --output_plt "${COUCHBASE_PLT}" --build_plt
15    --apps compiler crypto erts inets kernel os_mon sasl ssl stdlib xmerl
16    ${_couchdb_bin_dir}/src/mochiweb
17    ${_couchdb_bin_dir}/src/snappy ${_couchdb_bin_dir}/src/etap
18    ${_couchdb_bin_dir}/src/lhttpc
19    ${_couchdb_bin_dir}/src/erlang-oauth deps/gen_smtp/ebin)
20ENDIF (NOT EXISTS "${COUCHBASE_PLT}")
21
22# Compute list of .beam files
23FILE (GLOB beamfiles RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" ebin/*.beam)
24STRING (REGEX REPLACE "ebin/(couch_api_wrap(_httpc)?).beam\;?" "" beamfiles "${beamfiles}")
25
26FILE (GLOB couchdb_beamfiles RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" deps/ns_couchdb/ebin/*.beam)
27STRING (REGEX REPLACE "deps/ns_couchdb/ebin/couch_log.beam\;?" "" couchdb_beamfiles "${couchdb_beamfiles}")
28
29# If you update the dialyzer command, please also update this echo
30# command so it displays what is invoked. Yes, this is annoying.
31EXECUTE_PROCESS (COMMAND "${CMAKE_COMMAND}" -E echo
32  dialyzer --plt "${COUCHBASE_PLT}" ${DIALYZER_FLAGS}
33  --apps ${beamfiles}
34  deps/ale/ebin
35  ${_couchdb_bin_dir}/src/couchdb ${_couchdb_bin_dir}/src/couch_set_view ${_couchdb_bin_dir}/src/couch_view_parser
36  ${_couchdb_bin_dir}/src/couch_index_merger/ebin
37  ${_couchdb_bin_dir}/src/mapreduce
38  deps/ns_babysitter/ebin
39  deps/ns_ssl_proxy/ebin
40  ${couchdb_beamfiles})
41EXECUTE_PROCESS (RESULT_VARIABLE _failure
42  COMMAND dialyzer --plt "${COUCHBASE_PLT}" ${DIALYZER_FLAGS}
43  --apps ${beamfiles}
44  deps/ale/ebin
45  ${_couchdb_bin_dir}/src/couchdb ${_couchdb_bin_dir}/src/couch_set_view ${_couchdb_bin_dir}/src/couch_view_parser
46  ${_couchdb_bin_dir}/src/couch_index_merger/ebin
47  ${_couchdb_bin_dir}/src/mapreduce
48  deps/ns_babysitter/ebin
49  deps/ns_ssl_proxy/ebin
50  ${couchdb_beamfiles})
51IF (_failure)
52  MESSAGE (FATAL_ERROR "failed running dialyzer")
53ENDIF (_failure)
54