Skip to content

Commit

Permalink
Cmake edits (#1243)
Browse files Browse the repository at this point in the history
* clean up CMakeLists.txt

* updates for sdktool and test

* cxx_standard
  • Loading branch information
dguittet authored Nov 14, 2024
1 parent da7f153 commit ff30186
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
11 changes: 3 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,11 @@ if(APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "12" CACHE STRING "Minimum OS X deployment version")
endif()

if (UNIX AND NOT CMAKE_C_COMPILER)
set(CMAKE_C_COMPILER gcc)
set(CMAKE_CXX_COMPILER g++)
endif()
set(CMAKE_CXX_STANDARD 11)

if ( NOT APPLE)
set(CURL_DIR build_resources/libcurl_ssl_x64)
endif()

Project(sam_simulation_core VERSION 1.0.0)
Project(sam_simulation_core VERSION 1.0.0 LANGUAGES CXX C)


#####################################################################################################################
Expand Down Expand Up @@ -82,14 +76,15 @@ function(set_default_compile_options target)
set(MAIN_CFLAGS "")
endif()
set(MAIN_CFLAGS "${MAIN_CFLAGS} -D__64BIT__")
set_property(TARGET ${target} PROPERTY CXX_STANDARD 11)
set_property(TARGET ${target} PROPERTY CXX_STANDARD_REQUIRED ON)
if(MSVC)
set(MAIN_CFLAGS "${MAIN_CFLAGS} /bigobj /MP")
set(MAIN_CFLAGS "${MAIN_CFLAGS} /D__WINDOWS__ /D_WINDOWS /D_CRT_SECURE_NO_WARNINGS /DLPWINAPP")
foreach (flag_var CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG)
set(${flag_var} "${${flag_var}} /D_DEBUG" CACHE STRING "compile flags" FORCE)
endforeach()
else(MSVC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
if (APPLE)
set(MAIN_CFLAGS "${MAIN_CFLAGS} -fno-common -DWX_PRECOMP -D__MACOSX__")
else()
Expand Down
8 changes: 6 additions & 2 deletions sdktool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,15 @@ endif()
target_link_libraries(SDKtool ${wxWidgets_LIBRARIES})

if (UNIX AND NOT APPLE)
target_link_libraries(SDKtool -ldl -lfontconfig)
target_link_libraries(SDKtool ${CMAKE_DL_LIBS} -lfontconfig)
endif()

if (UNIX)
target_link_libraries(SDKtool -lm -lcurl)
find_library(MATH_LIBRARY m)
if(MATH_LIBRARY)
target_link_libraries(SDKtool ${MATH_LIBRARY})
endif()
target_link_libraries(SDKtool -lcurl)
elseif (MSVC)
find_library( CURL_LIB
NAMES libcurl.lib
Expand Down
9 changes: 7 additions & 2 deletions ssc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,16 @@ set( DEPENDENCIES
splinter
)
foreach( name ${DEPENDENCIES} )
target_link_libraries(ssc ${name})
target_link_libraries(ssc PUBLIC ${name})
endforeach()

if (UNIX)
target_link_libraries(ssc -lpthread -lm -ldl -lstdc++)
find_package(Threads REQUIRED)
target_link_libraries(ssc PUBLIC Threads::Threads ${CMAKE_DL_LIBS})
find_library(MATH_LIBRARY m)
if(MATH_LIBRARY)
target_link_libraries(ssc PUBLIC ${MATH_LIBRARY})
endif()
endif()


Expand Down
3 changes: 2 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ endif()
target_link_libraries(Test ssc splinter)

if (UNIX)
target_link_libraries(Test -ldl -lpthread)
find_package(Threads REQUIRED)
target_link_libraries(Test Threads::Threads ${CMAKE_DL_LIBS})
endif()


Expand Down

0 comments on commit ff30186

Please sign in to comment.