I came across this and just wanted to give some feedback on what I came across while dealing with this same problem. The MCU I am using the STM32G031. What I discovered is, don't go by only what is said in the datasheet. You have to look at the reference manual. The datasheet for the STM32G031 did not specify that the STM32G031 could take an external clock source as depicted in Aaron's answer.
Almost all STM32 MCUs allow for the HSE and sometimes the LSE to be selectable as either Crystal/Ceramic Oscillator or BYPASS Clock Source. For the Crystal/Ceramic Oscillator, you have both an input and an output from the MCU as OSC_IN and OSC_OUT. With BYPASS Clock Source you get only OSC_IN, which, for example, would get the square wave CMOS output from a TCXO. You can do this right from CubeMX or do it manually. Here is the section in the reference manual that describes it.
External source (LSE bypass)
In this mode, an external clock source must be provided. It can have a frequency of up to
1 MHz. You select this mode by setting the LSEBYP and LSEON bits in the Backup domain
control register (RCC_BDCR). The external clock signal (square, sinus or triangle) with
~50% duty cycle has to drive the OSC32_IN pin while the OSC32_OUT pin should be left
I checked this on another MCU I had used and it was the same thing. I had seen the BYPASS Clock Source in CubeMX many times, but never knew what it mean't until now that I actually have to use. I believe the language they are using here for this option is something like this: The STM32 has a built in op amp style circuit that, when combined with your supplied oscillator (eg. crystal), makes a clock. You may also BYPASS the "MCUs clock" and provide your own in the form of, for example, an external TCXO (that has it's own built in mems or crystal resonator) with a square wave output.