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

Build fails if -Wpedantic-errors or -Weverything compiler flags are set #24

Open
kernelwernel opened this issue Aug 15, 2023 · 0 comments

Comments

@kernelwernel
Copy link

as the title says, the build process fails if either flags are included in my CMAKE_CXX_FLAGS. I've provided a replication of the error:

error:

CMake Error at cmake/modules.cmake:135 (add_library):
  No SOURCES given to target: MODULES
Call Stack (most recent call first):
  CMakeLists.txt:27 (add_module_library)

file structure:

.
├── cmake
│   └── modules.cmake
├── CMakeLists.txt
└── src
    ├── hello.cpp
    ├── main.cpp
    └── subdir
        └── bye.cpp

CMakeLists.txt:

cmake_minimum_required(VERSION 3.26)
project(modtest)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# this works
#set(CMAKE_CXX_FLAGS "-w -Wall -Wextra -Werror -Wshadow -Wconversion -Wunused -Wpedantic")
# but this doesn't
set(CMAKE_CXX_FLAGS "-w -Wall -Wextra -Werror -Wshadow -Wconversion -Wunused -Wpedantic -Wpedantic-errors -Weverything")

set(PROJECT "${CMAKE_CURRENT_SOURCE_DIR}")
set(TARGET "modtest")

file(GLOB_RECURSE SRC "${PROJECT}/src/*.cpp")

add_executable(${TARGET} ${PROJECT}/src/main.cpp)

include(cmake/modules.cmake)

add_module_library(MODULES ${SRC})

target_link_libraries(${TARGET} PRIVATE MODULES)

main:

import hello;
import bye;

int main() {
    hello();
    bye();
}

hello:

module;

#include <iostream>

export module hello;

export void hello() {
    std::cout << "hello\n";
}

bye:

module;

#include <iostream>

export module bye;

export void bye() {
    std::cout << "bye\n";
}
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