fixes cmake for mac, adds define option for building tests

This commit is contained in:
Sam Hatchett
2018-06-06 18:14:36 -05:00
parent 80a0acc26b
commit 9520b6d253

View File

@@ -10,7 +10,6 @@
# properly installed. Build using Visual Studio requires msbuild shell. # properly installed. Build using Visual Studio requires msbuild shell.
# #
# Example Usage: # Example Usage:
# cd build/cmake
# mkdir buildproducts # mkdir buildproducts
# cd buildproducts # cd buildproducts
# cmake .. # cmake ..
@@ -29,7 +28,7 @@
# Generic Invocation: # Generic Invocation:
# cmake -E make_directory buildprod # cmake -E make_directory buildprod
# cd build # cd build
# cmake -G GENERATOR -DCMAKE_BUILD_TYPE=Release .. # cmake -G GENERATOR -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=1 ..
# cmake --build . --target SOME_TARGET --config Release # cmake --build . --target SOME_TARGET --config Release
# #
# More information: # More information:
@@ -42,8 +41,10 @@ cmake_minimum_required (VERSION 2.8.8)
project(EPANET) project(EPANET)
add_subdirectory(tools/epanet-output) add_subdirectory(tools/epanet-output)
add_subdirectory(tests)
IF (BUILD_TESTS)
add_subdirectory(tests)
ENDIF (BUILD_TESTS)
# Sets for output directory for executables and libraries. # Sets for output directory for executables and libraries.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
@@ -55,8 +56,8 @@ SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
IF (APPLE) IF (APPLE)
SET(CMAKE_INSTALL_NAME_DIR @executable_path) SET(INSTALL_NAME_DIR @executable_path/../lib)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH ON) SET(CMAKE_MACOSX_RPATH 1)
ENDIF (APPLE) ENDIF (APPLE)
IF (MSVC) IF (MSVC)