Skip to content

[cmake] Metabuild system script change suggestion#13

Open
Dalmurii wants to merge 3 commits intomackron:masterfrom
ae2f:master
Open

[cmake] Metabuild system script change suggestion#13
Dalmurii wants to merge 3 commits intomackron:masterfrom
ae2f:master

Conversation

@Dalmurii
Copy link

removed library fetching on host UNIX -> target not UNIX.

		find_library(LIB_ATOMIC NAMES atomic)
		if(LIB_ATOMIC)
			list(APPEND COMMON_LINK_LIBRARIES ${LIB_ATOMIC})
		endif()

This part tries to fetch native library when targetted for MINGW, CGWIN, etc therefore linker panics. Funny.
I have bypassed them by simply not fetching libatomic under these conditions, under assumptions

separated build/install interface for smooth installation scenario.

target_include_directories(c89atomic PUBLIC  ${CMAKE_CURRENT_SOURCE_DIR})

source prefixed including will cause error on installing c89atomic.
separated include directories with build/install interface.

Dalmurii and others added 3 commits September 21, 2025 18:33
 Changes to be committed:
	modified:   CMakeLists.txt
	but target environment is not native.
		(for now, CGWIN, MINGW, ...)

 Changes to be committed:
	- modified:   CMakeLists.txt
	since c89atomics may use its header.

 Changes to be committed:
	- modified:   CMakeLists.txt
@mackron
Copy link
Owner

mackron commented Feb 10, 2026

Thanks for this. I think this looks fine, but now all of my other libraries will have the same issues... That'll be fun.

So what's the issue with the target_include_directories() thing? Not doubting your PR or anything, I just don't do a whole lot with CMake so I'm a bit ignorant and I'd just like to properly understand exactly what it is I'm merging.

Out of curiosity, with the libatomic thing, are you using MinGW from a Linux host? And that actually produces Windows executables? I had always just assumed you needed to run MinGW from a Windows host.

@Dalmurii
Copy link
Author

Dalmurii commented Feb 10, 2026

target_include_directories thing

When this library is to be installed as package (with install)
, since headers are to be fetched from somewhere else not from this codebase (the source)
, cmake will permit us no source-prefixed path to include when it's known as target.

That BUILD_INTERFACE INSTALL_INTERFACE thing is to separate the required path whether the process is building (you just want to compile & link) or installing (you want to ship your linked output to somewhere and one to use it).

MinGW libatomic thing

Yes it compiles something for Windows on Linux host. All you need to shift is some dll files simillar to vcruntime Microsoft requires us to install. Quite amazing.

I am using your project as a dependency of my personal open-source project.
My projects includes compiling tiny third-party tools I've written on configuring and running them on building.

I was checking if third-party tools are compiled for a host while I target another, like compiling mingw output on linux.

This is it if you do not mind: https://github.com/ae2f/Sys/

@Dalmurii
Copy link
Author

Hello are you there

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

Successfully merging this pull request may close these issues.

2 participants