Trying to fix cmake scripts

This commit is contained in:
Lew Rossman
2025-04-03 11:51:30 -04:00
parent 50f79c6ce8
commit 2c667e6449
2 changed files with 12 additions and 18 deletions

View File

@@ -1,4 +1,4 @@
# CMakeLists.txt - CMake configuration file for EPANET 2.0 # CMakeLists.txt - CMake configuration file for EPANET 2.3
# #
# CMake is a cross-platform build tool. CMake generates platform native # CMake is a cross-platform build tool. CMake generates platform native
# build systems that can be used with your compiler of choice. CMake uses a # build systems that can be used with your compiler of choice. CMake uses a
@@ -25,7 +25,7 @@
# CMake is available at https://cmake.org/download/ # CMake is available at https://cmake.org/download/
# #
cmake_minimum_required (VERSION 3.5.2) cmake_minimum_required (VERSION 3.8.0)
project(EPANET) project(EPANET)
@@ -34,12 +34,12 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
option(BUILD_SHARED_LIBS "Build using shared libraries" ON) option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
option(BUILD_TESTS "Build tests (requires Boost)" OFF) option(BUILD_TESTS "Build tests (requires Boost)" OFF)
option(BUILD_PY_LIB "Build library for Python wrapper" OFF) #option(BUILD_PY_LIB "Build library for Python wrapper" OFF)
option(BUILD_COVERAGE "Build library for coverage" OFF) option(BUILD_COVERAGE "Build library for coverage" OFF)
IF (NOT BUILD_PY_LIB) #IF (NOT BUILD_PY_LIB)
add_subdirectory(run) add_subdirectory(run)
ENDIF (NOT BUILD_PY_LIB) #ENDIF (NOT BUILD_PY_LIB)
add_subdirectory(src/outfile) add_subdirectory(src/outfile)
IF (BUILD_TESTS) IF (BUILD_TESTS)
@@ -60,17 +60,14 @@ IF (BUILD_TESTS)
add_subdirectory(tests/util) add_subdirectory(tests/util)
ENDIF (BUILD_TESTS) ENDIF (BUILD_TESTS)
# Sets the output directory for executables and libraries. # Sets the output directory for executables and libraries.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
# Sets the position independent code property for all targets # Sets the position independent code property for all targets
SET(CMAKE_POSITION_INDEPENDENT_CODE ON) SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
IF (APPLE) IF (APPLE)
set(INSTALL_NAME_DIR @executable_path/../lib) set(INSTALL_NAME_DIR @executable_path/../lib)
set(CMAKE_MACOSX_RPATH 1) set(CMAKE_MACOSX_RPATH 1)
@@ -84,8 +81,6 @@ ENDIF (MSVC)
# configure file groups # configure file groups
file(GLOB EPANET_SOURCES RELATIVE ${PROJECT_SOURCE_DIR} src/*.c src/util/*.c) file(GLOB EPANET_SOURCES RELATIVE ${PROJECT_SOURCE_DIR} src/*.c src/util/*.c)
file(GLOB EPANET_LIB_ALL RELATIVE ${PROJECT_SOURCE_DIR} src/* src/util/*) file(GLOB EPANET_LIB_ALL RELATIVE ${PROJECT_SOURCE_DIR} src/* src/util/*)
# exclude epanet python API from the default build
list(REMOVE_ITEM EPANET_LIB_ALL "src/epanet_py.c")
source_group("Library" FILES ${EPANET_LIB_ALL}) source_group("Library" FILES ${EPANET_LIB_ALL})
# the shared library # the shared library
@@ -101,10 +96,8 @@ ENDIF(MSVC AND "${CMAKE_VS_PLATFORM_NAME}" MATCHES "(Win32)")
target_include_directories(epanet2 PUBLIC ${PROJECT_SOURCE_DIR}/include) target_include_directories(epanet2 PUBLIC ${PROJECT_SOURCE_DIR}/include)
install(TARGETS epanet2 DESTINATION lib) install(TARGETS epanet2 DESTINATION .)
install(FILES ./include/epanet2.h DESTINATION include) install(TARGETS runepanet DESTINATION .)
install(FILES ./include/epanet2_2.h DESTINATION include) install(FILES ./include/epanet2.h DESTINATION .)
install(FILES ./include/epanet2_enums.h DESTINATION include) install(FILES ./include/epanet2_2.h DESTINATION .)
install(DIRECTORY ./src/ DESTINATION include FILES_MATCHING PATTERN "*.h") install(FILES ./include/epanet2_enums.h DESTINATION .)

View File

@@ -1,5 +1,5 @@
# EPANET COMMAND LINE EXECUTABLE # EPANET COMMAND LINE EXECUTABLE
cmake_minimum_required (VERSION 2.8.8) cmake_minimum_required (VERSION 3.8.0)
# Sets for output directory for executables and libraries. # Sets for output directory for executables and libraries.
@@ -31,3 +31,4 @@ if(NOT WIN32)
else(NOT WIN32) else(NOT WIN32)
target_link_libraries(runepanet LINK_PUBLIC epanet2) target_link_libraries(runepanet LINK_PUBLIC epanet2)
endif(NOT WIN32) endif(NOT WIN32)