Page 1 of 1

C++20/23 Modules support

Posted: Tue Aug 20, 2024 3:30 pm
by lukash256
hello !

I am trying to follow new style of codding and I think that it's time to start new project with C++ Modules
but I get in troubles with compilation.

I just try to follow official tutorial from KitWare site https://www.kitware.com/import-cmake-th ... t-is-over/
and combine it with material from this forum

my CMakeLists.txt:

Code: Select all

add_library(mod)
target_sources(mod
	PUBLIC
	FILE_SET CXX_MODULES FILES
	"mod.cxx"
)

idf_component_register(SRCS "main.cxx"
                    INCLUDE_DIRS ".")


target_link_libraries(COMPONENT_LIB PUBLIC mod)

but it seams that "add_library" command is not supported:
CMake Error at D:/Espressif/frameworks/esp-idf-v5.3/tools/cmake/component.cmake:225 (message):
CMake Warning (dev) at build_properties.temp.cmake:8:

Syntax Warning in cmake code at column 106



Argument not separated from preceding token by whitespace.

Call Stack (most recent call first):

D:/Espressif/frameworks/esp-idf-v5.3/tools/cmake/scripts/component_get_requirements.cmake:3 (include)

This warning is for project developers. Use -Wno-dev to suppress it.



fatal: not a git repository (or any of the parent directories): .git

CMake Error at C:/Users/lukash256/esp32
proj/tstForGopher/main/CMakeLists.txt:2 (add_library):

add_library command is not scriptable

Call Stack (most recent call first):

D:/Espressif/frameworks/esp-idf-v5.3/tools/cmake/scripts/component_get_requirements.cmake:107 (include)
D:/Espressif/frameworks/esp-idf-v5.3/tools/cmake/scripts/component_get_requirements.cmake:127 (__component_get_requirements)





Call Stack (most recent call first):
D:/Espressif/frameworks/esp-idf-v5.3/tools/cmake/build.cmake:586 (__component_get_requirements)
D:/Espressif/frameworks/esp-idf-v5.3/tools/cmake/project.cmake:710 (idf_build_process)
CMakeLists.txt:11 (project)


-- Configuring incomplete, errors occurred!


sooo Can anybody share knowledges about building esp_idf project based on c++ Modules ?

Re: C++20/23 Modules support

Posted: Wed Aug 21, 2024 11:37 am
by aliarifat794

Re: C++20/23 Modules support

Posted: Wed Aug 21, 2024 3:15 pm
by lukash256
I have already checked it.
Thanks

Re: C++20/23 Modules support

Posted: Wed Aug 21, 2024 7:26 pm
by chegewara
I would suggest to remove/replace this

Code: Select all

add_library(mod)
....

add_library command is not scriptable  <----------------

https://github.com/espressif/esp-idf/is ... 1827342060