@@ -69,8 +69,9 @@ endif()
6969set (THREADS_PREFER_PTHREAD_FLAG ON )
7070find_package (Threads REQUIRED)
7171
72- set ( Boost_USE_STATIC_LIBS ON )
73- set ( CMAKE_FIND_LIBRARY_SUFFIXES .a .la .lib ${CMAKE_FIND_LIBRARY_SUFFIXES} )
72+ if ( Boost_USE_STATIC_LIBS )
73+ set ( CMAKE_FIND_LIBRARY_SUFFIXES .a .la .lib )
74+ endif ()
7475
7576
7677set ( headers ${headers} cambio/Cambio_config.h.in )
@@ -87,7 +88,7 @@ if( BUILD_CAMBIO_GUI )
8788
8889 if (WIN32 )
8990 find_package (Qt5 COMPONENTS WinExtras REQUIRED)
90- else ( )
91+ elseif ( APPLE )
9192 find_package (Qt5 COMPONENTS MacExtras REQUIRED)
9293 endif ()
9394
@@ -148,6 +149,7 @@ endif( APPLE AND BUILD_CAMBIO_GUI )
148149if ( BUILD_CAMBIO_COMMAND_LINE )
149150 set ( headers ${headers} cambio/CommandLineUtil.h )
150151 set ( sources ${sources} src/CommandLineUtil.cpp )
152+ find_library ( BOOST_PROGRAM_OPTIONS boost_program_options REQUIRED)
151153endif ( BUILD_CAMBIO_COMMAND_LINE )
152154
153155if ( NOT BUILD_CAMBIO_GUI AND NOT BUILD_CAMBIO_COMMAND_LINE )
@@ -157,12 +159,16 @@ endif( NOT BUILD_CAMBIO_GUI AND NOT BUILD_CAMBIO_COMMAND_LINE )
157159
158160add_executable ( ${PROJECT_NAME} ${GUI_TYPE} main.cpp ${sources} ${headers} )
159161
162+ if ( BUILD_CAMBIO_COMMAND_LINE )
163+ target_link_libraries ( ${PROJECT_NAME} PRIVATE ${BOOST_PROGRAM_OPTIONS} )
164+ endif ()
165+
160166if ( NOT BUILD_CAMBIO_GUI )
161167 if ( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
162168 #Right now we are copying all of libpthread into our executable to force copying weak symbols in.
163169 # Instead, to save size should specify the functions we actually need using '-u pthread_create', etc.
164170 # Could maybe add a "-no_weak_exports" flag to the linker as well to make sure none missing.
165- set ( CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} "-static - pthread -Wl,--whole-archive -lpthread -Wl,--no-whole-archive" )
171+ set ( CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} "-pthread -Wl,--whole-archive -lpthread -Wl,--no-whole-archive" )
166172 target_link_libraries ( ${PROJECT_NAME} PRIVATE -static -libgcc -static -libstdc++ )
167173 endif ( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
168174endif ( NOT BUILD_CAMBIO_GUI )
0 commit comments