Cannot Build CMake Project That Uses Both AWS SDK CPP & AWS Lambda CPP #3068
-
Hi, I'm trying to setup aws-lambda-cpp and aws-sdk-cpp in my C++ project. I'm using vcpkg as my package manager. However, when I'm trying to build my project I keep getting the following error from CMake. CMake Configure Log[main] Configuring project: path-tracer-core [driver] Removing /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/CMakeCache.txt [driver] Removing /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/CMakeFiles [proc] Executing command: /usr/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_TOOLCHAIN_FILE:FILEPATH=/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_INSTALL_PREFIX=/workspaces/distributed-path-tracer/path-tracer-core/out/install/x64-debug-linux -S/workspaces/distributed-path-tracer/path-tracer-core -B/workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux -G Ninja [cmake] -- Building Path Tracer... [cmake] -- Running vcpkg install [cmake] Detecting compiler hash for triplet x64-linux... [cmake] Compiler found: /usr/bin/c++ [cmake] All requested packages are currently installed. [cmake] Total install time: 371 ns [cmake] aws-lambda-cpp provides CMake targets: [cmake] [cmake] # this is heuristically generated, and may not be correct [cmake] find_package(aws-lambda-runtime CONFIG REQUIRED) [cmake] target_link_libraries(main PRIVATE AWS::aws-lambda-runtime) [cmake] [cmake] The package aws-sdk-cpp:x64-linux provides CMake targets: [cmake] [cmake] When using AWSSDK, AWSSDK_ROOT_DIR must be defined by the user. [cmake] find_package(AWSSDK CONFIG COMPONENTS core dynamodb kinesis s3 REQUIRED) [cmake] target_include_directories(main PRIVATE ${AWSSDK_INCLUDE_DIRS}) [cmake] target_link_libraries(main PRIVATE ${AWSSDK_LIBRARIES}) [cmake] [cmake] OR [cmake] [cmake] find_package(aws-cpp-sdk-core REQUIRED) [cmake] target_include_directories(main PRIVATE aws-cpp-sdk-core) [cmake] target_link_libraries(main PRIVATE aws-cpp-sdk-core) [cmake] [cmake] The package spdlog provides CMake targets: [cmake] [cmake] find_package(spdlog CONFIG REQUIRED) [cmake] target_link_libraries(main PRIVATE spdlog::spdlog) [cmake] [cmake] # Or use the header-only version [cmake] find_package(spdlog CONFIG REQUIRED) [cmake] target_link_libraries(main PRIVATE spdlog::spdlog_header_only) [cmake] [cmake] -- Running vcpkg install - done [cmake] -- The C compiler identification is Clang 15.0.7 [cmake] -- The CXX compiler identification is Clang 15.0.7 [cmake] -- Detecting C compiler ABI info [cmake] -- Detecting C compiler ABI info - done [cmake] -- Check for working C compiler: /usr/bin/clang - skipped [cmake] -- Detecting C compile features [cmake] -- Detecting C compile features - done [cmake] -- Detecting CXX compiler ABI info [cmake] -- Detecting CXX compiler ABI info - done [cmake] -- Check for working CXX compiler: /usr/bin/clang++ - skipped [cmake] -- Detecting CXX compile features [cmake] -- Detecting CXX compile features - done [cmake] -- Building Path Tracer Lib... [cmake] -- Looking for pthread.h [cmake] -- Looking for pthread.h - found [cmake] -- Performing Test CMAKE_HAVE_LIBC_PTHREAD [cmake] -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success [cmake] -- Found Threads: TRUE [cmake] -- Found OpenSSL: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/debug/lib/libcrypto.a (found suitable version "3.3.1", minimum required is "3") [cmake] -- Found ZLIB: optimized;/workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/lib/libz.a;debug;/workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/debug/lib/libz.a (found suitable version "1.3.1", minimum required is "1") [cmake] -- Found AWS SDK for C++, Version: 1.11.352, Install Root:/workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux, Platform Prefix:, Platform Dependent Libraries: pthread;curl [cmake] -- Components specified for AWSSDK: s3;sqs;sns, application will be depending on libs: aws-cpp-sdk-s3;aws-cpp-sdk-sqs;aws-cpp-sdk-sns;aws-cpp-sdk-core;AWS::aws-crt-cpp;AWS::aws-c-http;AWS::aws-c-mqtt;AWS::aws-c-cal;AWS::aws-c-auth;AWS::aws-c-common;AWS::aws-c-io;AWS::aws-checksums;AWS::aws-c-event-stream;AWS::aws-c-s3;pthread;curl [cmake] -- Try finding aws-cpp-sdk-core [cmake] -- Found OpenSSL: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/debug/lib/libcrypto.a (found version "3.3.1") found components: Crypto [cmake] -- Found crypto: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/debug/lib/libcrypto.a [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- Found ZLIB: optimized;/workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/lib/libz.a;debug;/workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/debug/lib/libz.a (found version "1.3.1") [cmake] -- Found OpenSSL: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/debug/lib/libcrypto.a (found suitable version "3.3.1", minimum required is "3") [cmake] -- Found ZLIB: optimized;/workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/lib/libz.a;debug;/workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/debug/lib/libz.a (found suitable version "1.3.1", minimum required is "1") [cmake] -- Found aws-cpp-sdk-core [cmake] -- Try finding aws-cpp-sdk-sns [cmake] -- Found OpenSSL: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/debug/lib/libcrypto.a (found version "3.3.1") found components: Crypto [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- Found ZLIB: optimized;/workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/lib/libz.a;debug;/workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/debug/lib/libz.a (found version "1.3.1") [cmake] -- Found OpenSSL: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/debug/lib/libcrypto.a (found suitable version "3.3.1", minimum required is "3") [cmake] -- Found ZLIB: optimized;/workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/lib/libz.a;debug;/workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/debug/lib/libz.a (found suitable version "1.3.1", minimum required is "1") [cmake] -- Found aws-cpp-sdk-sns [cmake] -- Try finding aws-cpp-sdk-sqs [cmake] -- Found OpenSSL: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/debug/lib/libcrypto.a (found version "3.3.1") found components: Crypto [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- Found ZLIB: optimized;/workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/lib/libz.a;debug;/workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/debug/lib/libz.a (found version "1.3.1") [cmake] -- Found OpenSSL: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/debug/lib/libcrypto.a (found suitable version "3.3.1", minimum required is "3") [cmake] -- Found ZLIB: optimized;/workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/lib/libz.a;debug;/workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/debug/lib/libz.a (found suitable version "1.3.1", minimum required is "1") [cmake] -- Found aws-cpp-sdk-sqs [cmake] -- Try finding aws-cpp-sdk-s3 [cmake] -- Found OpenSSL: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/debug/lib/libcrypto.a (found version "3.3.1") found components: Crypto [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- aws-c-cal found target: AWS::crypto [cmake] -- crypto Include Dir: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/include [cmake] -- Found ZLIB: optimized;/workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/lib/libz.a;debug;/workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/debug/lib/libz.a (found version "1.3.1") [cmake] -- Found OpenSSL: /workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/debug/lib/libcrypto.a (found suitable version "3.3.1", minimum required is "3") [cmake] -- Found ZLIB: optimized;/workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/lib/libz.a;debug;/workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/vcpkg_installed/x64-linux/debug/lib/libz.a (found suitable version "1.3.1", minimum required is "1") [cmake] -- Found aws-cpp-sdk-s3 [cmake] CMake Error at /vcpkg/scripts/buildsystems/vcpkg.cmake:598 (_add_executable): [cmake] The target name "AWS::crypto" is reserved or not valid for certain CMake [cmake] features, such as generator expressions, and may result in undefined [cmake] behavior. [cmake] Call Stack (most recent call first): [cmake] CMakeLists.txt:40 (add_executable) [cmake] [cmake] [cmake] CMake Error at out/build/x64-debug-linux/vcpkg_installed/x64-linux/share/aws-lambda-runtime/aws-lambda-runtime-config.cmake:16 (add_custom_target): [cmake] The target name "aws-lambda-package-AWS::crypto" is reserved or not valid [cmake] for certain CMake features, such as generator expressions, and may result [cmake] in undefined behavior. [cmake] Call Stack (most recent call first): [cmake] CMakeLists.txt:47 (aws_lambda_package_target) [cmake] [cmake] [cmake] -- Configuring incomplete, errors occurred! [cmake] See also "/workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux/CMakeFiles/CMakeOutput.log". [proc] The command: /usr/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_TOOLCHAIN_FILE:FILEPATH=/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_INSTALL_PREFIX=/workspaces/distributed-path-tracer/path-tracer-core/out/install/x64-debug-linux -S/workspaces/distributed-path-tracer/path-tracer-core -B/workspaces/distributed-path-tracer/path-tracer-core/out/build/x64-debug-linux -G Ninja exited with code: 1 Here are my relevant project files: I'm using VSCode on a windows machine but using a dev container which uses the following Dockerfile DockerfileFROM amazonlinux:latest
RUN yum update -y && yum install -y git
RUN yum install -y zip unzip tar
# Setup Vcpkg
RUN git clone https://github.com/microsoft/vcpkg.git
RUN cd vcpkg && ./bootstrap-vcpkg.sh
ENV PATH="/vcpkg:$PATH"
# Install Cmake and Ninja
RUN yum install -y cmake ninja-build
# Install LLVM
RUN dnf install -y clang
# Install AWS Dependencies
RUN dnf install -y kernel-devel
RUN yum install -y libcurl-devel openssl-devel libuuid-devel pulseaudio-libs-devel Vcpkg.json{
"dependencies": [
"spdlog",
"aws-lambda-cpp",
{
"name": "aws-sdk-cpp",
"default-features": false,
"features": ["s3", "sns", "sqs"]
}
]
}
# CMakeList.txt : CMake project for path-tracer, include source and define
# project specific logic here.
#
cmake_minimum_required (VERSION 3.20)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
file(CREATE_LINK
"${CMAKE_BINARY_DIR}/compile_commands.json"
"${CMAKE_SOURCE_DIR}/compile_commands.json"
SYMBOLIC
)
set(CMAKE_CXX_STANDARD 20)
# Enable Hot Reload for MSVC compilers if supported.
if (POLICY CMP0141)
cmake_policy(SET CMP0141 NEW)
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
endif()
message(STATUS "Building Path Tracer...")
project ("distributed-path-tracer")
add_subdirectory("${CMAKE_SOURCE_DIR}/third_party/stb")
add_subdirectory("${CMAKE_SOURCE_DIR}/third_party/cgltf")
add_subdirectory("${CMAKE_SOURCE_DIR}/path_tracer")
# Add source to this project's executable.
set(TARGET_NAME "PathTracer")
set(INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
file(GLOB_RECURSE SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
find_package(spdlog CONFIG REQUIRED)
find_package(aws-lambda-runtime REQUIRED)
find_package(AWSSDK CONFIG COMPONENTS s3 sqs sns REQUIRED)
include_directories(${INCLUDE_DIR})
add_executable (${TARGET_NAME} ${SRC})
set_target_properties(${TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(${TARGET_NAME} INTERFACE path_tracer_lib spdlog::spdlog_header_only)
target_link_libraries(${TARGET_NAME} INTERFACE AWS::aws-lambda-runtime ${AWSSDK_LINK_LIBRARIES})
aws_lambda_package_target(${TARGET_NAME})
if (CMAKE_VERSION VERSION_GREATER 3.12)
set_property(TARGET ${TARGET_NAME} PROPERTY CXX_STANDARD 20)
endif()
# TODO: Add tests and install targets if needed.
Note: If I don't specify INTERFACE in the target_link_libraries, I'm getting the following additional error in the CMake Configure Log
I can also build my project if I only include aws-lambda-cpp, but get the same error if I include only the aws-sdk-cpp
I also tried to configure these dependencies by building from source instead of using vcpkg, but still got the same error. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
For anyone who comes across this and had the same issue as me, I was able to fix it by changing the variable TARGET_NAME in my previous CMakeLists.txt to just TARGET. Basically, set(TARGET_NAME "PathTracer") -> set(TARGET "PathTracer"). I'm not really well-versed with CMake to explain why this fixed it but here is the updated CMakeLists.txt for reference # CMakeList.txt : CMake project for path-tracer, include source and define
# project specific logic here.
#
cmake_minimum_required (VERSION 3.20)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
file(CREATE_LINK
"${CMAKE_BINARY_DIR}/compile_commands.json"
"${CMAKE_SOURCE_DIR}/compile_commands.json"
SYMBOLIC
)
set(CMAKE_CXX_STANDARD 20)
# Enable Hot Reload for MSVC compilers if supported.
if (POLICY CMP0141)
cmake_policy(SET CMP0141 NEW)
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
endif()
message(STATUS "Building Path Tracer...")
project ("distributed-path-tracer")
add_subdirectory("${CMAKE_SOURCE_DIR}/third_party/stb")
add_subdirectory("${CMAKE_SOURCE_DIR}/third_party/cgltf")
add_subdirectory("${CMAKE_SOURCE_DIR}/path_tracer")
# Add source to this project's executable.
set(TARGET "PathTracer")
set(INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
file(GLOB_RECURSE SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
find_package(spdlog CONFIG REQUIRED)
find_package(aws-lambda-runtime REQUIRED)
find_package(AWSSDK REQUIRED COMPONENTS s3 sns sqs)
include_directories(${INCLUDE_DIR})
add_executable (${TARGET} ${SRC})
set_target_properties(${TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(${TARGET} path_tracer_lib spdlog::spdlog_header_only AWS::aws-lambda-runtime ${AWSSDK_LINK_LIBRARIES})
aws_lambda_package_target(${TARGET})
if (CMAKE_VERSION VERSION_GREATER 3.12)
set_property(TARGET ${TARGET} PROPERTY CXX_STANDARD 20)
endif()
# TODO: Add tests and install targets if needed. |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
For anyone who comes across this and had the same issue as me, I was able to fix it by changing the variable TARGET_NAME in my previous CMakeLists.txt to just TARGET. Basically, set(TARGET_NAME "PathTracer") -> set(TARGET "PathTracer"). I'm not really well-versed with CMake to explain why this fixed it but here is the updated CMakeLists.txt for reference