5

I am building a project on linux with Bullet3 using CMake, and when building the entire solution it builds the output libraries of Bullet with the SOVERSION appended and creates a symlink without the version.

I do not like this behavior for my specific scenario, and I don't want to edit the bullet submodule's CMakeLists file.

Here's my CMake where I include bullet libs:

    set(USE_DOUBLE_PRECISION ON CACHE BOOL "" FORCE)
    set(BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE)
    
    set(BUILD_BULLET3 OFF CACHE BOOL "" FORCE)
    set(BUILD_EGL OFF CACHE BOOL "" FORCE)
    set(BUILD_ENET OFF CACHE BOOL "" FORCE)
    set(BUILD_PYBULLET OFF CACHE BOOL "" FORCE)
    set(BUILD_OPENGL3_DEMOS OFF CACHE BOOL "" FORCE)
    set(BUILD_BULLET2_DEMOS OFF CACHE BOOL "" FORCE)
    set(BUILD_EXTRAS OFF CACHE BOOL "" FORCE)
    set(BUILD_UNIT_TESTS OFF CACHE BOOL "" FORCE)
    
    set(INSTALL_LIBS OFF CACHE BOOL "" FORCE)
    set(USE_MSVC_RUNTIME_LIBRARY_DLL OFF CACHE BOOL "" FORCE)
    set(USE_GRAPHICAL_BENCHMARK OFF CACHE BOOL "" FORCE)
    set(USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD OFF CACHE BOOL "" FORCE)
    set(BUILD_CPU_DEMOS OFF CACHE BOOL "" FORCE)
    set(USE_GLUT OFF CACHE BOOL "" FORCE)
    SET(INTERNAL_CREATE_MSVC_RELATIVE_PATH_PROJECTFILES OFF CACHE BOOL "" FORCE)
    SET(INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES OFF CACHE BOOL "" FORCE)

    add_subdirectory("${PROJECT_SOURCE_DIR}/src/bullet3")

I would like the resulting bullet libs to be only one file per lib in the build directory, not two, doesn't matter if it has the version appended or not... I just don't want a symlink there.

I know I could simply run a script after to delete these but that would break my workflow big time at the moment.

Surely there must be a way to tell CMake not to do that?

I've read about NAMELINK_SKIP but if I understand correctly that is for the INSTALL command, but I am not even using the install command and I don't intend to in my project, I am currently getting the symlinks just with the initial build.

starball
  • 20,030
  • 7
  • 43
  • 238
ZOlivier
  • 224
  • 1
  • 11
  • why don't you want the symlink there? Is it for personal/aesthetic reasons? Or is there an "engineering" reason? – starball Sep 09 '22 at 06:23

1 Answers1

0

The target you are speaking of probably has either or both of the VERSION and SOVERSION properties set. The CMake docs for the VERSION and SOVERSION target properties state (emphasis added):

For shared libraries VERSION and SOVERSION can be used to specify the build version and API version respectively. When building or installing appropriate symlinks are created if the platform supports symlinks and the linker supports so-names. If only one of both is specified the missing is assumed to have the same version number.

What you can do is unset them with the following:

set_property(TARGET target_name_here PROPERTY VERSION)
set_property(TARGET target_name_here PROPERTY SOVERSION)

The above code would go after the add_subdirectory("${PROJECT_SOURCE_DIR}/src/bullet3").

This also means no symlinks for the installation. If you still wanted to have symlinks for the installation, I don't know how you'd do that.

starball
  • 20,030
  • 7
  • 43
  • 238