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

Side by Side Diff: CMakeLists.txt

Issue 1692083002: Update CMake build to support gflags and gtest correctly (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv.git@master
Patch Set: Created 4 years, 10 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 cmake_minimum_required(VERSION 2.8) 1 cmake_minimum_required(VERSION 2.8)
2 2
3 # CMakeLists for libyuv 3 # CMakeLists for libyuv
4 # Originally created for "roxlu build system" to compile libyuv on windows 4 # Originally created for "roxlu build system" to compile libyuv on windows
5 # Run with -DTEST=ON to build unit tests 5 # Run with -DTEST=ON to build unit tests
6 option(TEST "Built unit tests" OFF) 6 option(TEST "Built unit tests" OFF)
7 7
8 set(ly_base_dir ${CMAKE_CURRENT_LIST_DIR}) 8 set(ly_base_dir ${CMAKE_CURRENT_LIST_DIR})
9 set(ly_src_dir ${ly_base_dir}/source/) 9 set(ly_src_dir ${ly_base_dir}/source/)
10 set(ly_inc_dir ${ly_base_dir}/include) 10 set(ly_inc_dir ${ly_base_dir}/include)
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 include(FindJPEG) 103 include(FindJPEG)
104 if (JPEG_FOUND) 104 if (JPEG_FOUND)
105 include_directories(${JPEG_INCLUDE_DIR}) 105 include_directories(${JPEG_INCLUDE_DIR})
106 target_link_libraries(convert ${JPEG_LIBRARY}) 106 target_link_libraries(convert ${JPEG_LIBRARY})
107 add_definitions(-DHAVE_JPEG) 107 add_definitions(-DHAVE_JPEG)
108 endif() 108 endif()
109 109
110 if(TEST) 110 if(TEST)
111 find_library(GTEST_LIBRARY gtest) 111 find_library(GTEST_LIBRARY gtest)
112 if(GTEST_LIBRARY STREQUAL "GTEST_LIBRARY-NOTFOUND") 112 if(GTEST_LIBRARY STREQUAL "GTEST_LIBRARY-NOTFOUND")
113 set(GTEST_SRC_DIR /usr/src/gtest) 113 set(GTEST_SRC_DIR /usr/src/gtest CACHE STRING "Location of gtest sources")
114 if(EXISTS ${GTEST_SRC_DIR}/src/gtest-all.cc) 114 if(EXISTS ${GTEST_SRC_DIR}/src/gtest-all.cc)
115 message(STATUS "building gtest from sources in ${GTEST_SRC_DIR}") 115 message(STATUS "building gtest from sources in ${GTEST_SRC_DIR}")
116 set(gtest_sources ${GTEST_SRC_DIR}/src/gtest-all.cc) 116 set(gtest_sources ${GTEST_SRC_DIR}/src/gtest-all.cc)
117 add_library(gtest STATIC ${gtest_sources}) 117 add_library(gtest STATIC ${gtest_sources})
118 include_directories(${GTEST_SRC_DIR}) 118 include_directories(${GTEST_SRC_DIR})
119 include_directories(${GTEST_SRC_DIR}/include)
119 set(GTEST_LIBRARY gtest) 120 set(GTEST_LIBRARY gtest)
120 else() 121 else()
121 message(FATAL_ERROR "TEST is set but unable to find gtest library") 122 message(FATAL_ERROR "TEST is set but unable to find gtest library")
122 endif() 123 endif()
123 endif() 124 endif()
124 125
125 add_executable(libyuv_unittest ${ly_unittest_sources}) 126 add_executable(libyuv_unittest ${ly_unittest_sources})
126 target_link_libraries(libyuv_unittest ${ly_lib_name} ${GTEST_LIBRARY} pthread) 127 target_link_libraries(libyuv_unittest ${ly_lib_name} ${GTEST_LIBRARY} pthread)
127 if (JPEG_FOUND) 128 if (JPEG_FOUND)
128 target_link_libraries(libyuv_unittest ${JPEG_LIBRARY}) 129 target_link_libraries(libyuv_unittest ${JPEG_LIBRARY})
129 endif() 130 endif()
130 endif() 131 endif()
131 132
132 if(NACL AND NACL_LIBC STREQUAL "newlib") 133 if(NACL AND NACL_LIBC STREQUAL "newlib")
133 target_link_libraries(libyuv_unittest glibc-compat) 134 target_link_libraries(libyuv_unittest glibc-compat)
134 endif() 135 endif()
135 136
137 target_link_libraries(libyuv_unittest gflags)
138
136 install(TARGETS ${ly_lib_name} DESTINATION lib) 139 install(TARGETS ${ly_lib_name} DESTINATION lib)
137 install(FILES ${ly_header_files} DESTINATION include/libyuv) 140 install(FILES ${ly_header_files} DESTINATION include/libyuv)
138 install(FILES ${ly_inc_dir}/libyuv.h DESTINATION include/) 141 install(FILES ${ly_inc_dir}/libyuv.h DESTINATION include/)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698