Thanks all for discussion. The problem was fixed by adding "-shared" to target_link_libraries. target_link_libraries(shared ${LINK_LIBRARIES} -shared) Anton