Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ar: no archive members specified while building project with Cmake #361

Open
aggnostos opened this issue Aug 25, 2023 · 0 comments
Open

Comments

@aggnostos
Copy link

aggnostos commented Aug 25, 2023

I'm trying to build my project with Cmake but getting the following error:

[main] Building folder: passman 
[build] Starting build
[proc] Executing command: /opt/homebrew/bin/cmake --build /Users/user/Desktop/cpp/projects/passman/build --config Debug --target main --
[build] [1/2  50% :: 0.019] Linking CXX static library include/argon2/libargon2.a
[build] FAILED: include/argon2/libargon2.a 
[build] : && /opt/homebrew/Cellar/cmake/3.24.2/bin/cmake -E rm -f include/argon2/libargon2.a && /usr/bin/ar qc include/argon2/libargon2.a   && /usr/bin/ranlib include/argon2/libargon2.a && /opt/homebrew/Cellar/cmake/3.24.2/bin/cmake -E touch include/argon2/libargon2.a && :
[build] ar: no archive members specified
[build] usage:  ar -d [-TLsv] archive file ...
[build] 	ar -m [-TLsv] archive file ...
[build] 	ar -m [-abiTLsv] position archive file ...
[build] 	ar -p [-TLsv] archive [file ...]
[build] 	ar -q [-cTLsv] archive file ...
[build] 	ar -r [-cuTLsv] archive file ...
[build] 	ar -r [-abciuTLsv] position archive file ...
[build] 	ar -t [-TLsv] archive [file ...]
[build] 	ar -x [-ouTLsv] archive [file ...]
[build] ninja: build stopped: subcommand failed.
[proc] The command: /opt/homebrew/bin/cmake --build /Users/user/Desktop/cpp/projects/passman/build --config Debug --target main -- exited with code: 1
[driver] Build completed: 00:00:00.030
[build] Build finished with exit code 1

Here's a project structure:

├── CMakeLists.txt
├── build
    ...
├── include
 │  ├── argon2
 │   │   ├── CMakeLists.txt
 │   │   ├── argon2.h
 │   │   └── libargon2.a
└── src
    ├── CMakeLists.txt
    ├── main.cpp
    ├── passman.cpp
    └── passman.hpp

CmakeLists.txt inside incude/argon2:

cmake_minimum_required(VERSION 3.0.0)
project(argon2 LANGUAGES CXX)

add_library(argon2 STATIC argon2.h)
target_include_directories(argon2 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/>)
set_target_properties(argon2 PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED ON)
set_target_properties(argon2 PROPERTIES LINKER_LANGUAGE CXX)
add_library(argon2::argon2 ALIAS argon2)

CmakeLists.txt inside src:

cmake_minimum_required(VERSION 3.0.0)

add_executable(main main.cpp passman.cpp)

target_link_libraries(main PRIVATE argon2)

CmakeLists.txt inside root directory of the project:

cmake_minimum_required(VERSION 3.0.0)

project(PassMan CXX)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20")

include(CTest)
include(CPack)

enable_testing()

add_subdirectory(include/argon2)
add_subdirectory(src)
@aggnostos aggnostos changed the title fatal error: 'argon2.h' file not found ar: no archive members specified while building project with Cmake Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant