Skip to content

Commit

Permalink
Correct manual cmake build with MSVC build tools (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
felixmaisonneuve authored Nov 11, 2022
1 parent dfd4f1f commit 2c9fc16
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions api_cpp/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ endif()


option(USE_CONAN "Use the Conan package manager to automatically fetch the Kortex API" ON)

option(DOWNLOAD_API "Automatically download the API if conan is not used" ON)

# Activate C++ 11
set (CMAKE_CXX_STANDARD 11)
Expand Down Expand Up @@ -177,25 +177,30 @@ else() # Not using Conan
endif()

# Download the API
if(UNIX)
execute_process(COMMAND ./download_kortex_api.sh ${KORTEX_SUB_DIR}
WORKING_DIRECTORY ../scripts
RESULT_VARIABLE DOWNLOAD_API_RESULT
OUTPUT_VARIABLE DOWNLOAD_API_OUTPUT)
if(NOT DOWNLOAD_API_RESULT EQUAL 0)
message("Kortex API was not downloaded prior to running CMake.")
message(FATAL_ERROR ${DOWNLOAD_API_OUTPUT})
if(DOWNLOAD_API)
if(UNIX)
execute_process(COMMAND ./download_kortex_api.sh ${KORTEX_SUB_DIR}
WORKING_DIRECTORY ../scripts
RESULT_VARIABLE DOWNLOAD_API_RESULT
OUTPUT_VARIABLE DOWNLOAD_API_OUTPUT)
if(NOT DOWNLOAD_API_RESULT EQUAL 0)
message("Kortex API was not downloaded prior to running CMake.")
message(FATAL_ERROR ${DOWNLOAD_API_OUTPUT})
endif()
elseif(WIN32)
execute_process(COMMAND ./download_kortex_api.bat ${KORTEX_SUB_DIR}
WORKING_DIRECTORY ../scripts
RESULT_VARIABLE DOWNLOAD_API_RESULT
OUTPUT_VARIABLE DOWNLOAD_API_OUTPUT)
if(NOT DOWNLOAD_API_RESULT EQUAL 0)
message("Kortex API was not downloaded prior to running CMake.")
message(FATAL_ERROR ${DOWNLOAD_API_OUTPUT})
endif()
endif()
endif()
if(UNIX)
link_libraries(${KORTEX_DIR}lib/${KORTEX_LIB_SUBDIR}/libKortexApiCpp.a)
elseif(WIN32)
execute_process(COMMAND ./download_kortex_api.bat ${KORTEX_SUB_DIR}
WORKING_DIRECTORY ../scripts
RESULT_VARIABLE DOWNLOAD_API_RESULT
OUTPUT_VARIABLE DOWNLOAD_API_OUTPUT)
if(NOT DOWNLOAD_API_RESULT EQUAL 0)
message("Kortex API was not downloaded prior to running CMake.")
message(FATAL_ERROR ${DOWNLOAD_API_OUTPUT})
endif()
link_libraries(${KORTEX_DIR}lib/${KORTEX_LIB_SUBDIR}/KortexApiCpp.lib)
endif()

Expand Down

0 comments on commit 2c9fc16

Please sign in to comment.