Skip to content

pico_add_extra_outputs( ) puts map file in wrong directory for add_subdirectory( ) projects #1753

@smithps

Description

@smithps

I am using Visual Studio with VisualGDB to make a complex project and my Cmakelists.txt was getting a bit out of hand. I then created a sub folder to split my project into pieces. I found that the .map file for my executable that was in the subfolder was found in the directory above where the other extra output files were.

I have recreated the issue by simply using the "Hello Serial" example, then adding another copy of "Hello Serial" called "Hello2 Serial".

The contents of my top level Cmakelists.txt is as so.

cmake_minimum_required(VERSION 3.12)
include(${PICO_SDK_PATH}/pico_sdk_init.cmake)

project(Hello C CXX ASM)
pico_sdk_init()

set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
add_executable(hello_serial
        hello_serial.c
        )

# pull in common dependencies
target_link_libraries(hello_serial pico_stdlib)

# create map/bin/hex/uf2 file etc.
pico_add_extra_outputs(hello_serial)

# add url via pico_set_program_url
# example_auto_set_url(hello_serial)

add_subdirectory(Hello2)

The subdirectory Hello2 contains an almost identical Cmakelists.txt with hello_serial replaced with Hello2_serial everywhere,... The outputs I get are as follows:

ProjectDir
   |
   |__ VisualGDB
              |
              |___ Debug
                         |
                         |___ hello_serial.bin
                         |___ hello_serial.dis
                         |___ hello_serial.elf
                         |___ hello_serial.elf.map
                         |___ hello_serial.hex
                         |___ hello_serial.uf2
                         |___ hello2_serial.elf.map         <--  Expected to be in folder "Hello2"
                         |___ Hello2
                                    |___ hello2_serial.bin
                                    |___ hello2_serial.dis
                                    |___ hello2_serial.elf
                                    |___ hello2_serial.hex
                                    |___ hello2_serial.uf2
                
     

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions