Skip to content

Commit

Permalink
fix cmake syntax for finding credentials.cmake
Browse files Browse the repository at this point in the history
When building this project from another cmake project, I get an error
even though I have credentials.cmake (this is on Debian Bookworm using
cmake 3.25):

    CMake Warning at pico-w-webserver-example/CMakeLists.txt:24 (message):
      Credentials file not found, using default values!

Per the cmake docs, `if EXISTS` requires full/absolute paths; relative
paths do not have well-defined behavior:

    <https://cmake.org/cmake/help/latest/command/if.html#exists>
  • Loading branch information
SebKuzminsky authored and krzmaz committed Oct 9, 2023
1 parent 6eee377 commit 3727cb2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ set(PICO_SDK_FETCH_FROM_GIT on)
include(cmake/pico_sdk_import.cmake)


if(EXISTS cmake/credentials.cmake)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/cmake/credentials.cmake)
# copy it over from cmake/credentials.cmake.example
include(cmake/credentials.cmake)
else()
Expand Down

0 comments on commit 3727cb2

Please sign in to comment.