modifies cmake to link shared lib to the CLI
also much improved IDE file grouping, for people who use IDEs
This commit is contained in:
26
CMakeLists.txt
Normal file → Executable file
26
CMakeLists.txt
Normal file → Executable file
@@ -56,18 +56,26 @@ IF (MSVC)
|
|||||||
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||||
ENDIF (MSVC)
|
ENDIF (MSVC)
|
||||||
|
|
||||||
set(EPANET_API_HEADER "include/epanet2.h")
|
|
||||||
|
|
||||||
# create object library for reuse in other targets
|
# create object library for reuse in other targets
|
||||||
include_directories(include; src)
|
include_directories(include src)
|
||||||
|
|
||||||
|
# configure file groups
|
||||||
file(GLOB EPANET_SOURCES src/*.c)
|
file(GLOB EPANET_SOURCES src/*.c)
|
||||||
add_library(epanet_objs OBJECT ${EPANET_SOURCES})
|
set(EPANET_API_HEADER include/epanet2.h)
|
||||||
|
set(EPANET_CLI_SOURCES run/main.c)
|
||||||
|
|
||||||
|
file(GLOB EPANET_LIB_ALL src/*)
|
||||||
|
source_group("Library" FILES ${EPANET_LIB_ALL})
|
||||||
|
source_group("CLI" REGULAR_EXPRESSION "run/.*")
|
||||||
|
|
||||||
# the shared library
|
# the shared library
|
||||||
add_library(epanet SHARED $<TARGET_OBJECTS:epanet_objs> ${EPANET_API_HEADER})
|
add_library(epanet SHARED ${EPANET_SOURCES} ${EPANET_API_HEADER})
|
||||||
|
|
||||||
# the standalone executable
|
# the standalone executable
|
||||||
add_executable(runepanet run/main.c $<TARGET_OBJECTS:epanet_objs>)
|
add_executable(runepanet ${EPANET_CLI_SOURCES})
|
||||||
if (NOT MSVC)
|
|
||||||
target_link_libraries (runepanet m)
|
if(NOT MSVC)
|
||||||
endif (NOT MSVC)
|
target_link_libraries(runepanet LINK_PUBLIC epanet m)
|
||||||
|
else(NOT MSVC)
|
||||||
|
target_link_libraries(runepanet LINK_PUBLIC epanet)
|
||||||
|
endif(NOT MSVC)
|
||||||
|
|||||||
Reference in New Issue
Block a user