Skip to content

Commit 14c5476

Browse files
starseekercshorler
authored andcommitted
Use straight-up CMake commands in lieu of wrapping
The basic CMake commands are more straightforward to work with for someone not familiar with stepcode, and we don't really have enough targets w/ apply-this-to-everything add-ons to need the more elaborate logic the way BRL-CAD does (which is what originally inspired them.)
1 parent f7e929f commit 14c5476

File tree

1 file changed

+39
-19
lines changed

1 file changed

+39
-19
lines changed

src/express/CMakeLists.txt

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,36 @@ if(SC_GENERATE_LP_SOURCES)
8585
set_source_files_properties(express.c lexact.c PROPERTIES OBJECT_DEPENDS "${PERPLEX_ExpScanner_HDR};${LEMON_ExpParser_HDR}")
8686
endif()
8787

88+
if(BUILD_SHARED_LIBS OR NOT BUILD_STATIC_LIBS)
89+
add_library(express SHARED ${EXPRESS_OBJS})
90+
target_link_libraries(express base)
91+
if(OPENBSD)
92+
set_target_properties(express PROPERTIES VERSION ${SC_VERSION_MAJOR}.${SC_VERSION_MINOR})
93+
else(OPENBSD)
94+
set_target_properties(express PROPERTIES VERSION ${SC_VERSION} SOVERSION ${SC_VERSION_MAJOR})
95+
endif(OPENBSD)
96+
if(APPLE)
97+
set_property(TARGET express APPEND PROPERTY LINK_FLAGS "-flat_namespace -undefined suppress")
98+
endif(APPLE)
99+
install(TARGETS express
100+
RUNTIME DESTINATION ${BIN_DIR}
101+
LIBRARY DESTINATION ${LIB_DIR}
102+
ARCHIVE DESTINATION ${LIB_DIR})
103+
104+
if(MSVC)
105+
set_property(TARGET express APPEND PROPERTY COMPILE_DEFINITIONS "SC_EXPRESS_DLL_EXPORTS")
106+
set_property(TARGET express APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS "SC_EXPRESS_DLL_IMPORTS")
107+
endif(MSVC)
108+
endif()
109+
110+
if(BUILD_STATIC_LIBS)
111+
add_library(express-static STATIC ${EXPRESS_OBJS})
112+
install(TARGETS express-static
113+
RUNTIME DESTINATION ${BIN_DIR}
114+
LIBRARY DESTINATION ${LIB_DIR}
115+
ARCHIVE DESTINATION ${LIB_DIR})
116+
endif()
117+
88118
# TODO
89119
# Currently, fedex.c provides the main() for multiple programs. These programs
90120
# provide custom behavior by defining EXPRESSinit_init (called by fedex.c's
@@ -99,26 +129,16 @@ set(CHECK_EXPRESS_SOURCES
99129
inithook.c
100130
)
101131

102-
SET(EXPRESS_PRIVATE_HDRS
103-
exptoks.h
104-
stack.h
105-
)
106-
107-
variable_watch(SC_ADDLIB_EXPRESS_ARG_LINK_LIBRARIES)
108-
variable_watch(SC_ADDLIB_EXPRESS-STATIC_ARG_LINK_LIBRARIES)
109-
110-
if("$CACHE{SC_BUILD_SHARED_LIBS}" OR NOT "$CACHE{SC_BUILD_STATIC_LIBS}")
111-
SC_ADDLIB(express SHARED SOURCES "dummy.c" ${EXPRESS_OBJS} LINK_LIBRARIES base)
112-
if(WIN32)
113-
target_compile_definitions(express PRIVATE SC_EXPRESS_DLL_EXPORTS)
114-
endif()
132+
add_executable(check-express ${CHECK_EXPRESS_SOURCES})
133+
if(BUILD_SHARED_LIBS OR NOT BUILD_STATIC_LIBS)
134+
target_link_libraries(check-express express base)
135+
else()
136+
target_link_libraries(check-express express-static base-static)
115137
endif()
116-
117-
if($CACHE{SC_BUILD_STATIC_LIBS})
118-
SC_ADDLIB(express-static STATIC SOURCES "dummy.c" ${EXPRESS_OBJS} LINK_LIBRARIES base-static)
119-
endif()
120-
121-
SC_ADDEXEC(check-express SOURCES ${CHECK_EXPRESS_SOURCES} LINK_LIBRARIES express base ${SC_EXEC_NOINSTALL})
138+
install(TARGETS check-express
139+
RUNTIME DESTINATION ${BIN_DIR}
140+
LIBRARY DESTINATION ${LIB_DIR}
141+
ARCHIVE DESTINATION ${LIB_DIR})
122142

123143
if(SC_ENABLE_TESTING)
124144
add_subdirectory(test)

0 commit comments

Comments
 (0)