-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up the Find Google Test and Xorg GTest logic, put them in their…
… own cmake files behind their own functions. Make it so that all users can see xorg-gtest and not just the users in tests/
- Loading branch information
Sam Spilsbury
committed
Feb 12, 2013
1 parent
5619809
commit 37e24f6
Showing
11 changed files
with
152 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Find Google Test and Google Mock, either with pkg-config or by | ||
# searching the system install paths. This sets: | ||
# | ||
# GOOGLE_TEST_AND_MOCK_FOUND | ||
# GTEST_INCLUDE_DIR | ||
# GTEST_ROOT_DIR | ||
# GMOCK_LIBRARY | ||
# GMOCK_MAIN_LIBRARY | ||
|
||
find_package (GTest) | ||
|
||
if (NOT GTEST_FOUND) | ||
|
||
# Check for google test and build it locally | ||
set (GTEST_ROOT_DIR | ||
"/usr/src/gtest" # Default value, adjustable by user with e.g., ccmake | ||
CACHE | ||
PATH | ||
"Path to Google Test srcs" | ||
FORCE) | ||
|
||
find_path (GTEST_INCLUDE_DIR gtest/gtest.h) | ||
|
||
set (GTEST_BOTH_LIBRARIES gtest gtest_main) | ||
set (GTEST_FOUND TRUE) | ||
set (GTEST_LOCAL_BUILD_REQUIRED TRUE) | ||
|
||
else (NOT GTEST_FOUND) | ||
|
||
set (GTEST_LOCAL_BUILD_REQUIRED FALSE) | ||
|
||
endif (NOT GTEST_FOUND) | ||
|
||
find_library (GMOCK_LIBRARY gmock) | ||
find_library (GMOCK_MAIN_LIBRARY gmock_main) | ||
|
||
if (NOT GMOCK_LIBRARY OR NOT GMOCK_MAIN_LIBRARY OR NOT GTEST_FOUND) | ||
|
||
message ("Google Mock and Google Test not found - cannot build tests!") | ||
set (GOOGLE_TEST_AND_MOCK_FOUND OFF CACHE BOOL "" FORCE) | ||
|
||
else (NOT GMOCK_LIBRARY OR NOT GMOCK_MAIN_LIBRARY OR NOT GTEST_FOUND) | ||
|
||
set (GOOGLE_TEST_AND_MOCK_FOUND ON CACHE BOOL "" FORCE) | ||
|
||
endif (NOT GMOCK_LIBRARY OR NOT GMOCK_MAIN_LIBRARY OR NOT GTEST_FOUND) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Find xorg-gtest,with pkg-config. This sets: | ||
# | ||
# XORG_GTEST_FOUND | ||
# XORG_SERVER_INCLUDE_XORG_GTEST | ||
# XORG_SERVER_GTEST_SRC | ||
|
||
# xorg-gtest | ||
pkg_check_modules (XORG_SERVER xorg-gtest xorg-server x11 xi) | ||
|
||
if (XORG_SERVER_FOUND) | ||
|
||
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=prefix xorg-gtest OUTPUT_VARIABLE _xorg_gtest_prefix) | ||
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=includedir xorg-gtest OUTPUT_VARIABLE _xorg_gtest_include_dir) | ||
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=sourcedir xorg-gtest OUTPUT_VARIABLE _xorg_gtest_source_dir) | ||
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=CPPflags xorg-gtest OUTPUT_VARIABLE _xorg_gtest_cflags) | ||
|
||
string (STRIP ${_xorg_gtest_prefix} _xorg_gtest_prefix) | ||
string (STRIP ${_xorg_gtest_include_dir} _xorg_gtest_include_dir) | ||
string (STRIP ${_xorg_gtest_source_dir} _xorg_gtest_source_dir) | ||
string (STRIP ${_xorg_gtest_cflags} _xorg_gtest_cflags) | ||
|
||
set (XORG_SERVER_GTEST_INCLUDES ${XORG_SERVER_INCLUDE_DIRS}) | ||
set (XORG_SERVER_GTEST_LIBRARY_DIRS ${XORG_SERVER_LIBRARIES}) | ||
set (XORG_SERVER_GTEST_LIBRARIES} ${XORG_SERVER_LIBRARIES}) | ||
set (XORG_SERVER_INCLUDE_XORG_GTEST ${_xorg_gtest_include_dir} CACHE PATH "Path to Xorg GTest Headers") | ||
set (XORG_SERVER_GTEST_SRC ${_xorg_gtest_source_dir} CACHE PATH "Path to Xorg GTest Sources") | ||
set (XORG_SERVER_GTEST_CFLAGS ${_xorg_gtest_cflags}) | ||
set (XORG_SERVER_GTEST_ROOT ${CMAKE_SOURCE_DIR}/tests/xorg-gtest CACHE PATH "Path to Xorg GTest CMake sources") | ||
set (COMPIZ_XORG_SYSTEM_TEST_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/tests/xorg-gtest/include CACHE PATH "Path to Compiz Xorg GTest Headers") | ||
|
||
message (STATUS "Found xorg-gtest sources at " ${XORG_SERVER_GTEST_SRC}) | ||
set (XORG_GTEST_FOUND ON) | ||
|
||
else (XORG_SERVER_FOUND) | ||
|
||
message (WARNING "Could not found xorg-gtest, can't build xserver tests") | ||
set (XORG_GTEST_FOUND OFF) | ||
|
||
endif (XORG_SERVER_FOUND) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# GoogleTest.cmake | ||
# build_google_test_locally (dir) takes a subdirectory | ||
# and builds Google Test in there locally if required | ||
|
||
function (build_google_test_locally build_directory) | ||
|
||
if (GOOGLE_TEST_AND_MOCK_FOUND) | ||
|
||
if (GTEST_LOCAL_BUILD_REQUIRED) | ||
|
||
add_subdirectory (${GTEST_ROOT_DIR} | ||
${build_directory}) | ||
|
||
endif (GTEST_LOCAL_BUILD_REQUIRED) | ||
|
||
include_directories (${GTEST_INCLUDE_DIRS}) | ||
|
||
endif (GOOGLE_TEST_AND_MOCK_FOUND) | ||
|
||
endfunction () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# XorgGTest.cmake | ||
# | ||
# build_xorg_gtest_locally (dir) specifies a subdirectory to | ||
# build xorg-gtest in locally | ||
|
||
function (build_xorg_gtest_locally build_directory) | ||
|
||
if (XORG_GTEST_FOUND) | ||
|
||
add_subdirectory (${XORG_SERVER_GTEST_ROOT} ${build_directory}) | ||
|
||
endif (XORG_GTEST_FOUND) | ||
|
||
endfunction () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,5 @@ | ||
include (FindPkgConfig) | ||
if (BUILD_XORG_GTEST) | ||
|
||
pkg_check_modules (XORG_SERVER xorg-gtest xorg-server x11) | ||
|
||
option (BUILD_XORG_GTEST "Build Xorg GTest integration tests" OFF) | ||
|
||
if (XORG_SERVER_FOUND AND BUILD_XORG_GTEST) | ||
|
||
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=prefix xorg-gtest OUTPUT_VARIABLE _xorg_gtest_prefix) | ||
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=includedir xorg-gtest OUTPUT_VARIABLE _xorg_gtest_include_dir) | ||
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=sourcedir xorg-gtest OUTPUT_VARIABLE _xorg_gtest_source_dir) | ||
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=CPPflags xorg-gtest OUTPUT_VARIABLE _xorg_gtest_cflags) | ||
|
||
string (STRIP ${_xorg_gtest_prefix} _xorg_gtest_prefix) | ||
string (STRIP ${_xorg_gtest_include_dir} _xorg_gtest_include_dir) | ||
string (STRIP ${_xorg_gtest_source_dir} _xorg_gtest_source_dir) | ||
string (STRIP ${_xorg_gtest_cflags} _xorg_gtest_cflags) | ||
|
||
set (XORG_SERVER_INCLUDE_XORG_GTEST ${_xorg_gtest_include_dir} CACHE PATH "Path to Xorg GTest Headers") | ||
set (XORG_SERVER_GTEST_SRC ${_xorg_gtest_source_dir} CACHE PATH "Path to Xorg GTest Sources") | ||
set (COMPIZ_XORG_SYSTEM_TEST_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE PATH "Path to Compiz Xorg GTest Headers") | ||
|
||
message (STATUS "Found xorg-gtest sources at " ${XORG_SERVER_GTEST_SRC}) | ||
|
||
add_subdirectory (src) | ||
add_subdirectory (tests) | ||
|
||
else (XORG_SERVER_FOUND AND BUILD_XORG_GTEST) | ||
|
||
message (WARNING "Could not found xorg-gtest, not building system tests") | ||
set (BUILD_XORG_GTEST OFF) | ||
|
||
endif (XORG_SERVER_FOUND AND BUILD_XORG_GTEST) | ||
endif (BUILD_XORG_GTEST) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
File renamed without changes.
File renamed without changes.