0

Running this command: cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTING=OFF -DBUILD_ONLY="s3" -DFORCE_SHARED_CRT=OFF -DBUILD_SHARED_LIBS=OFF <aws-sdk-src> always links to shared libcurl, ssl libraries as you can see from (truncated) CMAKE output:

-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8") 
--   Zlib include directory: /usr/include
--   Zlib library: /usr/lib/x86_64-linux-gnu/libz.so
-- Encryption: Openssl
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libssl.so;/usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.0.2g") 
--   Openssl include directory: /usr/include
--   Openssl library: /usr/lib/x86_64-linux-gnu/libssl.so;/usr/lib/x86_64-linux-gnu/libcrypto.so
-- Http client: Curl
-- Found CURL: /usr/lib/x86_64-linux-gnu/libcurl.so (found version "7.47.0") 
--   Curl include directory: /usr/include
--   Curl library: /usr/lib/x86_64-linux-gnu/libcurl.so
-- Considering s3

How can I force it to link libz.a, libcurl.a instead?

cosmosb
  • 325
  • 2
  • 4
  • 7

1 Answers1

0

As libraries are searched mostly by find_library command, you may set variable CMAKE_FIND_LIBRARY_SUFFIXES for affect on extensions which are searched.

By specifying single extension with

-DCMAKE_FIND_LIBRARY_SUFFIXES=.a

you will force to search only static libraries.

By specifying several extensions with

"-DCMAKE_FIND_LIBRARY_SUFFIXES=.a;.so"

you tell CMake to prefer static libraries (.a) over shared ones (.so).

Tsyvarev
  • 60,011
  • 17
  • 110
  • 153
  • Tried -DCMAKE_FIND_LIBRARY_SUFFIXES, but it doesn't work. It is still linking to shared libraries. No errors. I verified static libs are present right next to shared libraries. – cosmosb Apr 25 '17 at 16:32
  • yes. I made sure I'm starting clean. Basically deleted all CMake generated files before running command with -DCMAKE_FIND_LIBRARY_SUFFIXES option. – cosmosb Apr 26 '17 at 06:22