Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Side by Side Diff: third_party/protobuf/cmake/examples.cmake

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 if(protobuf_VERBOSE)
2 message(STATUS "Protocol Buffers Examples Configuring...")
3 endif()
4
5 get_filename_component(examples_dir "../examples" ABSOLUTE)
6
7 if(protobuf_VERBOSE)
8 message(STATUS "Protocol Buffers Examples Configuring done")
9 endif()
10 include(ExternalProject)
11
12 # Internal utility function: Create a custom target representing a build of exam ples with custom options.
13 function(add_examples_build NAME)
14
15 ExternalProject_Add(${NAME}
16 PREFIX ${NAME}
17 SOURCE_DIR "${examples_dir}"
18 BINARY_DIR ${NAME}
19 STAMP_DIR ${NAME}/logs
20 INSTALL_COMMAND "" #Skip
21 LOG_CONFIGURE 1
22 CMAKE_CACHE_ARGS "-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}"
23 "-Dprotobuf_VERBOSE:BOOL=${protobuf_VERBOSE}"
24 ${ARGN}
25 )
26 set_property(TARGET ${NAME} PROPERTY FOLDER "Examples")
27 set_property(TARGET ${NAME} PROPERTY EXCLUDE_FROM_ALL TRUE)
28 endfunction()
29
30 # Add examples as an external project.
31 # sub_directory cannot be used because the find_package(protobuf) call would cau se failures with redefined targets.
32 add_examples_build(examples "-Dprotobuf_DIR:PATH=${CMAKE_BINARY_DIR}/${CMAKE_INS TALL_CMAKEDIR}")
33 add_dependencies(examples libprotobuf protoc)
34
35 option(protobuf_BUILD_EXAMPLES_MULTITEST "Build Examples in multiple configurati ons. Useful for testing." OFF)
36 mark_as_advanced(protobuf_BUILD_EXAMPLES_MULTITEST)
37 if(protobuf_BUILD_EXAMPLES_MULTITEST)
38 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
39
40 #Build using the legacy compatibility module.
41 add_examples_build(examples-legacy
42 "-Dprotobuf_DIR:PATH=${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}"
43 "-Dprotobuf_MODULE_COMPATIBLE:BOOL=TRUE"
44 )
45 add_dependencies(examples-legacy libprotobuf protoc)
46
47 #Build using the installed library.
48 add_examples_build(examples-installed
49 "-Dprotobuf_DIR:PATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}"
50 )
51
52 #Build using the installed library in legacy compatibility mode.
53 add_examples_build(examples-installed-legacy
54 "-Dprotobuf_DIR:PATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}"
55 "-Dprotobuf_MODULE_COMPATIBLE:BOOL=TRUE"
56 )
57 endif()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698