Then you can simply work with it as you would with other object library targets. But you will only get things like the .bar extension if you enable_language(FOO) (and that requires more work, see below).
Examples delivered with CMake itself are ASM or RC compilers.
The enable_language(FOO) Version
This needs four more files you could put in e.g. your project's CMake folder:
CMake\CMakeDetermineFOOCompiler.cmake
# Find the compiler
find_program(
CMAKE_FOO_COMPILER
NAMES "make_bar_from_foo"
HINTS "${CMAKE_SOURCE_DIR}"
DOC "FOO compiler"
)
mark_as_advanced(CMAKE_FOO_COMPILER)
set(CMAKE_FOO_SOURCE_FILE_EXTENSIONS foo;FOO)
set(CMAKE_FOO_OUTPUT_EXTENSION .bar)
set(CMAKE_FOO_COMPILER_ENV_VAR "FOO")
# Configure variables set in this file for fast reload later on
configure_file(${CMAKE_CURRENT_LIST_DIR}/CMakeFOOCompiler.cmake.in
${CMAKE_PLATFORM_INFO_DIR}/CMakeFOOCompiler.cmake)