Looking to compile both project.a and project.so libs and according to https://cgold.readthedocs.io/en/latest/tutorials/libraries/static-shared.html, the proper way to make a shared/staic library is...
set (LIB_NAME project)
set (FILE_NAMES
a.cc
b.cc
c.cc
d.cc
)
option(BUILD_SHARED_LIBS "Build shared libraries (.a/.so) instead of static ones (.lib/.a)" ON)
# Makes project.so but not project.a but should make both.
add_library(${LIB_NAME}
${FILE_NAMES}
)
Yet this is only making the project.so and not the project.a as well.
Now I can use the below workaround but this isnt how I should be doing it from what I am reading online.
set (LIB_NAME_SHARED project_shared)
set (LIB_NAME_STATIC project_static)
# Makes project_static.a
add_library(${LIB_NAME_STATIC} STATIC
${FILE_NAMES}
)
# Makes project_shared.so
add_library(${LIB_NAME_SHARED} SHARED
${FILE_NAMES}
)
Am I misunderstanding something here or can someone point me to whats possibly going on please and thanks!