Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SED for OSX does not use -r flag #20

Open
silicontrip opened this issue Jul 8, 2017 · 1 comment
Open

SED for OSX does not use -r flag #20

silicontrip opened this issue Jul 8, 2017 · 1 comment

Comments

@silicontrip
Copy link

to use extended regex on OSX's sed requires the -E flag.

@silicontrip
Copy link
Author

silicontrip commented Jul 8, 2017

the following patch fixes this and #21

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4b6df3f..c964a58 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,16 +27,30 @@ if (NOT BUILD_TYPE)
     set(CMAKE_BUILD_TYPE Debug)
 endif(NOT BUILD_TYPE)
 
+if (APPLE)
+  set(CMAKE_MACOSX_RPATH 1)
+  set(SED_COMMAND sed -E)
+else(APPLE)
+  set(SED_COMMAND sed -r)
+endif()
+
 # this figures out the Python include directories and adds them to the
 # header file search path
 execute_process(
     COMMAND python-config --includes
-    COMMAND sed -r "s/-I//g; s/ +/;/g"
+    COMMAND ${SED_COMMAND} "s/-I//g; s/ +/;/g"
     COMMAND tr -d '\n'
     OUTPUT_VARIABLE Python_Includes
 )
 message(STATUS "Python include dir:" ${Python_Includes})
 
+execute_process(
+       COMMAND python-config --libs
+       COMMAND tr -d '\n'
+       OUTPUT_VARIABLE Python_Link_Flags
+)
+message(STATUS "Python link flags:" ${Python_Link_Flags})
+
 include_directories(${Python_Includes})
 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
 
@@ -166,6 +180,7 @@ else (USE_CLIPPER_FOR_PYTHON)
 endif (USE_CLIPPER_FOR_PYTHON)
 target_link_libraries(area ${Boost_LIBRARIES})
 set_target_properties(area PROPERTIES PREFIX "") 
+set_target_properties(area PROPERTIES LINK_FLAGS "${Python_Link_Flags}")
 
 # this figures out where to install the Python modules
 execute_process(

silicontrip pushed a commit to silicontrip/libarea that referenced this issue Jul 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant