diff --git a/cmake/Findgmock.cmake b/cmake/Findgmock.cmake index 0ae1e6355194e9782f29b030d836923510a54948..8c1821d2e90729376a7f526148632c6fad3afc02 100644 --- a/cmake/Findgmock.cmake +++ b/cmake/Findgmock.cmake @@ -1,51 +1,28 @@ -# cmake/Findgmock.cmake +# The CERN Tape Archive(CTA) project +# Copyright(C) 2015 CERN # -# This file is part of the Castor project. -# See http://castor.web.cern.ch/castor +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# Copyright (C) 2003 CERN -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# -# castor-dev@cern.ch # +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -# We define here 2 main variables : GMOCK_LINK and GMOCK_SRC -# for slc6, GMOCK_SRC will be empty -# for cc7 and later it's GMOCK_LINK that will be empty -# If not empty, GMOCK_LIB is pointing to the gmock library -# If not empty, GMOCK_SRC will contain the name of the gmock-all.cc -# to be used (something like "/usr/src/gmock/gmock-all.cc") -# Executables should use GMOCK_LIB AND GMOCK_SRC so that -# compilation will work on all platforms -# +# This module will set the following variables: +# GMOCK_SRC -# deal with the gmock-all.cc file -set (GMOCK_ALL_FILE "/usr/src/gmock/gmock-all.cc") -IF (EXISTS ${GMOCK_ALL_FILE}) - set (GMOCK_SRC ${GMOCK_ALL_FILE} CACHE FILEPATH "Location of gmock-all.cc or empty if none exists") -ELSE (EXISTS ${GMOCK_ALL_FILE}) - set (GMOCK_SRC "" CACHE FILEPATH "Location of gmock-all.cc or empty if none exists") -ENDIF (EXISTS ${GMOCK_ALL_FILE}) +set(GMOCK_SRC "/usr/src/gmock/gmock-all.cc") -# deal with the gmock library -find_library(GMOCK_LIB gmock) -IF (GMOCK_LIB STREQUAL GMOCK_LIB-NOTFOUND) - set (GMOCK_LIB "") -ENDIF (GMOCK_LIB STREQUAL GMOCK_LIB-NOTFOUND) +if(NOT EXISTS ${GMOCK_SRC}) + unset(GMOCK_SRC) +endif(NOT EXISTS ${GMOCK_SRC}) -# check that either GMOCK_LIB or GMOCK_SRC is set -IF (NOT GMOCK_SRC AND NOT GMOCK_LIB) - Message(FATAL_ERROR "Gmock not found") -ENDIF (NOT GMOCK_SRC AND NOT GMOCK_LIB) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(gmock DEFAULT_MSG + GMOCK_SRC)