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

C++20 Module #8

Merged
merged 16 commits into from
Jun 2, 2024
Merged

C++20 Module #8

merged 16 commits into from
Jun 2, 2024

Conversation

VladimirShaleev
Copy link
Owner

Add support for C++ modules

Added target ipaddress::ipaddress-module

cmake_minimum_required(VERSION 3.28.0)

project(my-project LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 23)

add_subdirectory(third-party/ipaddress)

add_executable(my-project main.cpp)
target_link_libraries(my-project PRIVATE ipaddress::ipaddress-module)
set_target_properties(my-project PROPERTIES CXX_SCAN_FOR_MODULES ON)
set_target_properties(my-project PROPERTIES CXX_EXTENSIONS OFF)

which is enabled by the IPADDRESS_BUILD_MODULE option, which is OFF by default.

Then use the module:

#include <iostream>

import ipaddress;

int main() {
    auto ip = ipaddress::ipv4_address::parse<"127.0.0.1">();
    std::cout << ip << std::endl;
    return 0;
}

@github-actions github-actions bot added documentation Improvements or additions to documentation source Improvements or additions to source code tests Improvements or additions to tests package Improvements or additions to the packaging of deb package, rpm package, etc. CI Improvements or additions to workflows labels May 31, 2024
@VladimirShaleev VladimirShaleev merged commit 2242e88 into main Jun 2, 2024
174 checks passed
@VladimirShaleev VladimirShaleev deleted the cpp20-module branch June 2, 2024 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Improvements or additions to workflows documentation Improvements or additions to documentation package Improvements or additions to the packaging of deb package, rpm package, etc. source Improvements or additions to source code tests Improvements or additions to tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant