HAL
You didn't specify you wanted SPL, sorry not psychic
Look in the SPL examples, definitely in there, typically in the SystemInit() code at a register level, and SetSysClock() in a somewhat less terse form
STM32F0xx_StdPeriph_Lib_V1.5.0\Projects\STM32F0xx_StdPeriph_Examples\RCC\RCC_Example\system_stm32f0xx.c
STM32F10x_StdPeriph_Lib_V3.5.0\Project\STM32F10x_StdPeriph_Examples\RCC\RCC_ClockConfig
For HSE, turn HSE ON in RCC->CR and then wait for it to come ready, then select the HSE as the system clock, and wait for it to engage.
Don't want the PLL, then don't start it, or select it as the system clock.
Really not super complicated.