Change library search path on MacOS

When using mac ports GL/gl.h ends up outside the cmake search paths for
libraries and includes. By adding them to mk/macos/CMakeLists.txt they are now
available and make it possible to build g3d_viewer along with the rest of
megaglest. To make this work properly I had to move the inclusion of
mk/macos/CMakeLists.txt further up the master CMakeLists.txt so merged both IF
APPLE tests in to one.

This has built successfully through xcode and gnumake.
This commit is contained in:
Karl Goetz 2014-12-17 20:11:49 +11:00
parent c945a5721d
commit 0ce6fd3c5d
2 changed files with 6 additions and 4 deletions

View File

@ -81,6 +81,7 @@ endif()
## Compiler flags
IF(APPLE)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
include(${PROJECT_SOURCE_DIR}/mk/macosx/CMakeLists.txt)
ENDIF(APPLE)
IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
@ -365,10 +366,6 @@ IF(EXISTS "${PROJECT_SOURCE_DIR}/source/")
#endif()
ADD_SUBDIRECTORY( ${PROJECT_SOURCE_DIR}/source/tools/glexemel )
IF(APPLE)
include(${PROJECT_SOURCE_DIR}/mk/macosx/CMakeLists.txt)
ENDIF()
ADD_SUBDIRECTORY( ${PROJECT_SOURCE_DIR}/source/tests )
ENDIF()

View File

@ -25,7 +25,12 @@ IF(NOT CONFIG_HAS_BEEN_RUN_BEFORE)
ENDIF()
ENDIF(NOT CONFIG_HAS_BEEN_RUN_BEFORE)
# Include extra paths to search for includes; this is the default system wide macports path.
# Try to get /opt/local in my path http://stackoverflow.com/questions/1487752/how-do-i-instruct-cmake-to-look-for-libraries-installed-by-macports
# Try the better solutions when possible
INCLUDE_DIRECTORIES(/opt/local/include)
LINK_DIRECTORIES(/opt/local/lib)
##install part