File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed
Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change 11cmake_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
57set (LIBRARIES_DIR ${CMAKE_BINARY_DIR} /libraries)
68
79file (GLOB_RECURSE LIBRARIES "${PREBUILT_DIR} /*${CMAKE_STATIC_LIBRARY_SUFFIX} " )
810
911list (APPEND LIBRARIES ${LIBOPENCOR_STATIC_LIBRARY} )
1012
13+ # Extract the object files from our various libraries.
14+
1115if (WIN32 )
1216 set (OBJECT_FILE_SUFFIX ".obj" )
1317else ()
@@ -44,8 +48,13 @@ foreach(LIBRARY ${LIBRARIES})
4448 list (APPEND OBJECT_FILES ${OBJ_FILES} )
4549endforeach ()
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} )
You can’t perform that action at this time.
0 commit comments