Commit e555bc31 authored by Robert Kimball's avatar Robert Kimball Committed by Scott Cyphers

Set rpath so ngraph.so can find openmpi libraries (#3680)

* Add cmake util to find os type

* Change CENTOS to REDHAT

* Set RPATH based on OS type

* Remove debug strings
parent 3c27cc26
......@@ -73,6 +73,11 @@ if (UNIX AND NOT APPLE)
set(LINUX TRUE)
endif()
if (LINUX)
include(find_os_version)
find_os_version()
endif()
if ("${CMAKE_GENERATOR}" MATCHES "^Visual Studio.*$")
set(MSVS TRUE)
endif()
......@@ -326,6 +331,15 @@ if (LINUX)
set(CMAKE_BUILD_RPATH "$ORIGIN")
set(CMAKE_INSTALL_RPATH "$ORIGIN")
endif()
if (UBUNTU)
set(CMAKE_BUILD_RPATH "${CMAKE_BUILD_RPATH}:/usr/lib/x86_64-linux-gnu/openmpi4/lib")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:/usr/lib/x86_64-linux-gnu/openmpi4/lib")
elseif (REDHAT)
set(CMAKE_BUILD_RPATH "${CMAKE_BUILD_RPATH}:/usr/lib64/openmpi4/lib64")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:/usr/lib64/openmpi4/lib64")
endif()
message(STATUS "CMAKE_BUILD_RPATH ${CMAKE_BUILD_RPATH}")
message(STATUS "CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH}")
endif()
#-----------------------------------------------------------------------------------------------
......
# ******************************************************************************
# Copyright 2017-2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ******************************************************************************
function(find_os_version)
set(UBUNTU FALSE PARENT_SCOPE)
set(REDHAT FALSE PARENT_SCOPE)
if(EXISTS /etc/debian_version)
set(UBUNTU TRUE PARENT_SCOPE)
elseif(EXISTS /etc/redhat-release)
set(REDHAT TRUE PARENT_SCOPE)
endif()
endfunction()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment