File: CMakeLists.txt

package info (click to toggle)
qpid-proton 0.14.0-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 9,632 kB
  • ctags: 20,083
  • sloc: java: 39,624; ansic: 29,389; python: 16,581; cpp: 11,250; ruby: 6,618; perl: 2,641; php: 1,033; xml: 957; sh: 230; pascal: 52; makefile: 32
file content (54 lines) | stat: -rw-r--r-- 2,159 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#

if(BUILD_GO)

  set(examples electron/broker electron/receive electron/send proton/broker)
  file(GLOB_RECURSE example_source FOLLOW_SYMLINKS ${CMAKE_CURRENT_SOURCE_DIR}/*.go)

  # Build example exes
  foreach(example ${examples})
    string(REPLACE / _ target ${example})
    set(target "go_example_${target}")
    set(output ${CMAKE_CURRENT_BINARY_DIR}/${example})
    # Always run go_build, it will do nothing if there is nothing to do.
    # Otherwise it's too hard to get the dependencies right.
    add_custom_target(${target} ALL
      COMMAND ${GO_BUILD} ${GO_EXAMPLE_FLAGS} -o ${output} ${CMAKE_CURRENT_SOURCE_DIR}/${example}.go
      WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
      DEPENDS qpid-proton)
    list(APPEND example_targets ${target})
  endforeach()

  # Build test driver exe
  set(test_exe ${CMAKE_CURRENT_BINARY_DIR}/example_test)
  add_custom_target(go_example_test ALL
    COMMAND ${GO_TEST} -c -o ${test_exe} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.go
    WORKING_DIRECTORY ${CMAKE_BINARY_DIR})

  add_test(
    NAME go_example_electron_test
    COMMAND ${GO_ENV} ${test_exe} -dir ${CMAKE_CURRENT_BINARY_DIR}/electron -broker broker)

  add_test(
    NAME go_example_proton_test
    COMMAND ${GO_ENV} ${test_exe} -dir ${CMAKE_CURRENT_BINARY_DIR}/electron -broker ../proton/broker)

  list(APPEND ADDITIONAL_MAKE_CLEAN_FILES ${examples})
endif()