1
+ from conan .tools .microsoft import msvc_runtime_flag
1
2
from conans import ConanFile , CMake , tools
2
3
from conans .errors import ConanInvalidConfiguration
3
4
import os
@@ -33,6 +34,10 @@ class OctomapConan(ConanFile):
33
34
def _source_subfolder (self ):
34
35
return "source_subfolder"
35
36
37
+ @property
38
+ def _is_msvc (self ):
39
+ return str (self .settings .compiler ) in ["Visual Studio" , "msvc" ]
40
+
36
41
def export_sources (self ):
37
42
self .copy ("CMakeLists.txt" )
38
43
for patch in self .conan_data .get ("patches" , {}).get (self .version , []):
@@ -47,9 +52,7 @@ def configure(self):
47
52
del self .options .fPIC
48
53
49
54
def validate (self ):
50
- if self .options .shared and \
51
- ((self .settings .compiler == "Visual Studio" and "MTd" in self .settings .compiler .runtime ) or \
52
- (str (self .settings .compiler ) == "msvc" and self .settings .compiler .runtime == "static" and self .settings .compiler .runtime_type == "Debug" )):
55
+ if self .options .shared and self ._is_msvc and msvc_runtime_flag (self ) == "MTd" :
53
56
raise ConanInvalidConfiguration ("shared octomap doesn't support MTd runtime" )
54
57
55
58
def source (self ):
@@ -82,6 +85,9 @@ def _patch_sources(self):
82
85
# No -Werror
83
86
if tools .Version (self .version ) >= "1.9.6" :
84
87
tools .replace_in_file (compiler_settings , "-Werror" , "" )
88
+ # we want a clean rpath in installed shared libs
89
+ tools .replace_in_file (compiler_settings , "set(CMAKE_INSTALL_RPATH \" ${CMAKE_INSTALL_PREFIX}/lib\" )" , "" )
90
+ tools .replace_in_file (compiler_settings , "set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)" , "" )
85
91
86
92
def package (self ):
87
93
self .copy ("LICENSE.txt" , dst = "licenses" , src = os .path .join (self ._source_subfolder , "octomap" ))
0 commit comments