Reputation: 18117
I've got two different versions of the same library, one should be linked for 32bit and one for 64bit systems. Currently, I manually modify the CMake file to change the linked library according the system on which I am making. Is it possible to make this an automated task? Can CMake itself decide which lib to use based on the system?
target_link_libraries(${PRODUCT}
#lib32
lib64)
Upvotes: 1
Views: 610
Reputation: 78270
You should be able to use CMAKE_SIZEOF_VOID_P
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(MyLib lib64)
else()
set(MyLib lib32)
endif()
target_link_libraries(${PRODUCT} ${MyLib})
Upvotes: 4