Skip to content

Commit 4b29f46

Browse files
committed
New way to build the merged version of the static version of libOpenCOR.
1 parent 31c9b39 commit 4b29f46

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

cmake/staticlibrary/CMakeLists.txt

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
cmake_minimum_required(VERSION 3.15)
22

3-
project(StaticLibrary)
3+
project(libOpenCOR)
4+
5+
# Retrieve the path to the prebuilt libraries and that of libOpenCOR.
46

57
set(LIBRARIES_DIR ${CMAKE_BINARY_DIR}/libraries)
68

79
file(GLOB_RECURSE LIBRARIES "${PREBUILT_DIR}/*${CMAKE_STATIC_LIBRARY_SUFFIX}")
810

911
list(APPEND LIBRARIES ${LIBOPENCOR_STATIC_LIBRARY})
1012

13+
# Extract the object files from our various libraries.
14+
1115
if(WIN32)
1216
set(OBJECT_FILE_SUFFIX ".obj")
1317
else()
@@ -44,8 +48,13 @@ foreach(LIBRARY ${LIBRARIES})
4448
list(APPEND OBJECT_FILES ${OBJ_FILES})
4549
endforeach()
4650

47-
if(WIN32)
48-
execute_process(COMMAND ${CMAKE_AR} /NOLOGO /OUT:${LIBOPENCOR_STATIC_LIBRARY} ${OBJECT_FILES})
49-
else()
50-
execute_process(COMMAND ${CMAKE_AR} -r ${LIBOPENCOR_STATIC_LIBRARY} ${OBJECT_FILES})
51-
endif()
51+
# Create a new static library for libOpenCOR.
52+
53+
add_library(${CMAKE_PROJECT_NAME} STATIC
54+
src/dummy.cpp
55+
${OBJECT_FILES})
56+
57+
# Rename our new static library.
58+
59+
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD
60+
COMMAND ${CMAKE_COMMAND} -E rename $<TARGET_FILE:${CMAKE_PROJECT_NAME}> ${LIBOPENCOR_STATIC_LIBRARY})

cmake/staticlibrary/src/dummy.cpp

Whitespace-only changes.

0 commit comments

Comments
 (0)