[CMake] Different INSTALL target settings per project

Andrew White andrew.white at audinate.com
Tue Jul 3 02:04:45 EDT 2018


We have a number of projects that include other projects.  Some of the parent projects are cross-compile projects with various odd settings.

Example project:

	add_subdirectory(a)
	add_subdirectory(b)

I want to go:
	Install(TARGETS target_a program_b
		RUNTIME DESTINATION other-bin
	)

If I put it in the root CMakeLists.txt, CMake complains that the targets are not defined in this context.  But if I put an install() command in subdirs A and B, then the 'other-bin' output path will apply to all projects, not just this one.

Is there an easy way to specify custom install paths for targets in subdirectories without directly hacking the environment variables?

Thanks

--
Andrew



More information about the CMake mailing list