2016-12-11 07:28:28 +00:00
|
|
|
# This module checks for Mac Homebrew, MacPorts, or Fink, in that order, on Mac
|
|
|
|
# OS X.
|
|
|
|
#
|
|
|
|
# It will prepend the active package manager's paths to:
|
|
|
|
#
|
|
|
|
# CMAKE_FRAMEWORK_PATH
|
|
|
|
# CMAKE_INCLUDE_PATH
|
|
|
|
# CMAKE_LIBRARY_PATH
|
|
|
|
# CMAKE_PROGRAM_PATH
|
|
|
|
#
|
|
|
|
# In addition, the following commands are called with the package manager's
|
|
|
|
# paths:
|
|
|
|
#
|
2024-04-16 15:30:30 +00:00
|
|
|
# include_directories()
|
|
|
|
# link_directories()
|
2016-12-11 07:28:28 +00:00
|
|
|
#
|
|
|
|
# The paths of package managers not currently in $ENV{PATH} are added to
|
|
|
|
# CMAKE_IGNORE_PATH .
|
|
|
|
#
|
|
|
|
# Copyright (c) 2016, Rafael Kitover
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions are met:
|
|
|
|
#
|
|
|
|
# * Redistributions of source code must retain the above copyright notice, this
|
|
|
|
# list of conditions and the following disclaimer.
|
|
|
|
#
|
|
|
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
# this list of conditions and the following disclaimer in the documentation
|
|
|
|
# and/or other materials provided with the distribution.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
|
|
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
|
|
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
2024-04-16 15:30:30 +00:00
|
|
|
if(NOT APPLE)
|
|
|
|
return()
|
|
|
|
endif()
|
2016-12-11 07:28:28 +00:00
|
|
|
|
2024-04-16 15:30:30 +00:00
|
|
|
if(NOT "$ENV{IN_NIX_SHELL}" STREQUAL "")
|
|
|
|
message(STATUS "Configuring for Nix")
|
2016-12-11 07:28:28 +00:00
|
|
|
|
2024-04-16 15:30:30 +00:00
|
|
|
set(NIX ON)
|
2016-12-11 07:28:28 +00:00
|
|
|
|
2024-04-16 15:30:30 +00:00
|
|
|
set(CMAKE_IGNORE_PATH /opt/local /opt/local/bin /opt/local/include /opt/local/Library/Frameworks /opt/local/lib ${CMAKE_IGNORE_PATH})
|
|
|
|
set(CMAKE_IGNORE_PATH /sw /sw/bin /sw/include /sw/Library/Frameworks /sw/lib ${CMAKE_IGNORE_PATH})
|
|
|
|
elseif(EXISTS /usr/local/bin/brew AND $ENV{PATH} MATCHES "(^|:)/usr/local/bin/?(:|$)")
|
|
|
|
message(STATUS "Configuring for Mac Homebrew")
|
2016-12-11 07:28:28 +00:00
|
|
|
|
2024-04-16 15:30:30 +00:00
|
|
|
set(MAC_HOMEBREW ON)
|
2016-12-11 07:28:28 +00:00
|
|
|
|
2024-04-16 15:30:30 +00:00
|
|
|
set(CMAKE_IGNORE_PATH /opt/local /opt/local/bin /opt/local/include /opt/local/Library/Frameworks /opt/local/lib ${CMAKE_IGNORE_PATH})
|
|
|
|
set(CMAKE_IGNORE_PATH /sw /sw/bin /sw/include /sw/Library/Frameworks /sw/lib ${CMAKE_IGNORE_PATH})
|
2016-12-11 07:28:28 +00:00
|
|
|
|
2024-04-16 15:30:30 +00:00
|
|
|
set(CMAKE_FRAMEWORK_PATH /usr/local/Frameworks ${CMAKE_FRAMEWORK_PATH})
|
2016-12-11 07:28:28 +00:00
|
|
|
|
2024-04-16 15:30:30 +00:00
|
|
|
set(CMAKE_INCLUDE_PATH /usr/local/include ${CMAKE_INCLUDE_PATH})
|
|
|
|
include_directories("/usr/local/include")
|
|
|
|
|
|
|
|
set(CMAKE_LIBRARY_PATH /usr/local/lib ${CMAKE_LIBRARY_PATH})
|
|
|
|
link_directories("/usr/local/lib")
|
|
|
|
|
|
|
|
set(CMAKE_PROGRAM_PATH /usr/local/bin ${CMAKE_PROGRAM_PATH})
|
2023-05-07 23:41:51 +00:00
|
|
|
|
|
|
|
set(ZLIB_ROOT /usr/local/opt/zlib)
|
2024-04-16 15:30:30 +00:00
|
|
|
elseif(EXISTS /opt/local/bin/port AND $ENV{PATH} MATCHES "(^|:)/opt/local/bin/?(:|$)")
|
|
|
|
message(STATUS "Configuring for MacPorts")
|
2016-12-11 07:28:28 +00:00
|
|
|
|
2024-04-16 15:30:30 +00:00
|
|
|
set(MACPORTS ON)
|
2016-12-11 07:28:28 +00:00
|
|
|
|
2024-04-16 15:30:30 +00:00
|
|
|
set(CMAKE_IGNORE_PATH /sw /sw/bin /sw/include /sw/Library/Frameworks /sw/lib ${CMAKE_IGNORE_PATH})
|
2016-12-11 07:28:28 +00:00
|
|
|
|
2024-04-16 15:30:30 +00:00
|
|
|
set(CMAKE_FRAMEWORK_PATH /opt/local/Library/Frameworks ${CMAKE_FRAMEWORK_PATH})
|
2016-12-11 07:28:28 +00:00
|
|
|
|
2024-04-16 15:30:30 +00:00
|
|
|
set(CMAKE_INCLUDE_PATH /opt/local/include ${CMAKE_INCLUDE_PATH})
|
|
|
|
include_directories("/opt/local/include")
|
2016-12-11 07:28:28 +00:00
|
|
|
|
2024-04-16 15:30:30 +00:00
|
|
|
set(CMAKE_LIBRARY_PATH /opt/local/lib ${CMAKE_LIBRARY_PATH})
|
|
|
|
link_directories("/opt/local/lib")
|
2016-12-11 07:28:28 +00:00
|
|
|
|
2024-04-16 15:30:30 +00:00
|
|
|
set(CMAKE_PROGRAM_PATH /opt/local/bin ${CMAKE_PROGRAM_PATH})
|
|
|
|
elseif(EXISTS /sw/bin/fink AND $ENV{PATH} MATCHES "(^|:)/sw/bin/?(:|$)")
|
|
|
|
message(STATUS "Configuring for Fink")
|
2016-12-11 07:28:28 +00:00
|
|
|
|
2024-04-16 15:30:30 +00:00
|
|
|
set(FINK ON)
|
2016-12-11 07:28:28 +00:00
|
|
|
|
2024-04-16 15:30:30 +00:00
|
|
|
set(CMAKE_IGNORE_PATH /opt/local /opt/local/bin /opt/local/include /opt/local/Library/Frameworks /opt/local/lib ${CMAKE_IGNORE_PATH})
|
2016-12-11 07:28:28 +00:00
|
|
|
|
2024-04-16 15:30:30 +00:00
|
|
|
set(CMAKE_FRAMEWORK_PATH /sw/Library/Frameworks ${CMAKE_FRAMEWORK_PATH})
|
2016-12-11 07:28:28 +00:00
|
|
|
|
2024-04-16 15:30:30 +00:00
|
|
|
set(CMAKE_INCLUDE_PATH /sw/include ${CMAKE_INCLUDE_PATH})
|
|
|
|
include_directories("/sw/include")
|
2016-12-11 07:28:28 +00:00
|
|
|
|
2024-04-16 15:30:30 +00:00
|
|
|
set(CMAKE_LIBRARY_PATH /sw/lib ${CMAKE_LIBRARY_PATH})
|
|
|
|
link_directories("/sw/lib")
|
2016-12-11 07:28:28 +00:00
|
|
|
|
2024-04-16 15:30:30 +00:00
|
|
|
set(CMAKE_PROGRAM_PATH /sw/bin ${CMAKE_PROGRAM_PATH})
|
|
|
|
else()
|
2016-12-11 07:28:28 +00:00
|
|
|
# no package manager found or active, do nothing
|
2024-04-16 15:30:30 +00:00
|
|
|
return()
|
|
|
|
endif()
|
2016-12-11 07:28:28 +00:00
|
|
|
|
|
|
|
# only ignore /usr/local if brew is installed and not in the PATH
|
|
|
|
# in other cases, it is the user's personal installations
|
2024-04-16 15:30:30 +00:00
|
|
|
if(NOT MAC_HOMEBREW AND EXISTS /usr/local/bin/brew)
|
|
|
|
set(CMAKE_IGNORE_PATH /usr/local /usr/local/bin /usr/local/include /usr/local/Library/Frameworks /usr/local/lib /usr/local/opt/gettext/bin /usr/local/opt/gettext/lib ${CMAKE_IGNORE_PATH})
|
|
|
|
endif()
|